release #110
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release | |
| on: | |
| workflow_run: | |
| workflows: ['CI'] | |
| types: | |
| - completed | |
| branches: | |
| - master | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| set-version: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.head_branch == 'master' && github.event.workflow_run.conclusion == 'success' }} | |
| container: | |
| image: mcr.microsoft.com/dotnet/sdk:6.0 | |
| outputs: | |
| semVer: ${{ steps.gitversion.outputs.semVer }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: install deps | |
| run: | | |
| apt-get update && apt-get install -y jq git | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| git config user.email ${{ github.actor }}[email protected] | |
| git config user.name ${{ github.actor }} | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/[email protected] | |
| with: | |
| versionSpec: '5.x' | |
| - name: Set SemVer Version | |
| uses: gittools/actions/gitversion/[email protected] | |
| id: gitversion | |
| release: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: golang:1.24-bookworm | |
| env: | |
| FOO: Bar | |
| needs: set-version | |
| env: | |
| SEMVER: ${{ needs.set-version.outputs.semVer }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: install deps | |
| run: | | |
| apt-get update && apt-get install jq git -y | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| git config user.email ${{ github.actor }}[email protected] | |
| git config user.name ${{ github.actor }} | |
| - name: release library | |
| run: | | |
| task tag GIT_TAG=${SEMVER} REVISION=$GITHUB_SHA | |
| - name: build binary | |
| run: | | |
| task bin REVISION=$GITHUB_SHA GIT_TAG=${SEMVER} | |
| - name: Release binary | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.set-version.outputs.semVer }} | |
| # TODO: add additional info to the release | |
| generate_release_notes: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| files: ./dist/* | |
| prerelease: false |