diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b54e2b5e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release Go Client +on: + push: + branches: + - 'release/**' + +defaults: + run: + shell: bash + +env: + RELEASE_BRANCH: ${{ github.ref_name }} + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Extract release version from branch + uses: tmelliottjr/extract-regex-action@v1.5.0 + id: release-version + with: + regex: '(?<=release\/).*' + input: ${{ env.RELEASE_BRANCH }} + - name: Set and commit Go Client version + run: | + pushd internal/embedded + echo "${{ steps.release-version.resultString }}" > data/VERSION + + git commit -am "build(project): update go embedded version data" + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + cache: true + - name: Build Go Client + shell: bash + id: build-go + working-directory: cmd/zbctl + run: ./build.sh + - name: Collect Release artifacts + id: release-artifacts + run: | + ARTIFACT_DIR=$(mktemp -d) + cp cmd/zbctl/dist/zbctl "${ARTIFACT_DIR}/" + cp cmd/zbctl/dist/zbctl.exe "${ARTIFACT_DIR}/" + cp cmd/zbctl/dist/zbctl.darwin "${ARTIFACT_DIR}/" + echo "dir=${ARTIFACT_DIR}" >> $GITHUB_OUTPUT + - name: Upload Release Artifacts + uses: actions/upload-artifact@v4 + with: + name: release-artifacts + path: ${{ steps.release-artifacts.outputs.dir }} + retention-days: 5 + - name: Go Post-Release + run: | + # Publish Go tag for the release + git tag "clients/go/v${{ steps.release-version.resultString }}" + if [ "$PUSH_CHANGES" = "true" ]; then + git push origin "clients/go/v${{ steps.release-version.resultString }}" + fi