ci(github-actions): update release workflow #10
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| # tags: | |
| # - 'v*' | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build and Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| cache: true | |
| - name: Extract version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV | |
| - name: Jreleaser Assemble | |
| uses: jreleaser/release-action@v2 | |
| with: | |
| arguments: assemble | |
| env: | |
| JRELEASER_PROJECT_VERSION: ${{ env.VERSION }} | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: JReleaser assemble output | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| retention-days: 1 | |
| name: jreleaser-assemble | |
| path: | | |
| out/jreleaser/trace.log | |
| out/jreleaser/output.properties | |
| - name: Release | |
| uses: jreleaser/release-action@v2 | |
| with: | |
| arguments: release | |
| env: | |
| JRELEASER_PROJECT_VERSION: ${{ env.VERSION }} | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |