Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
ci: release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
megglos committed Sep 8, 2024
1 parent 8773edf commit 83275a6
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 83275a6

Please sign in to comment.