Merge pull request #45 from ThibaultNocchi/ThibaultNocchi-patch-1 #53
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: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| # Add permissions block | |
| permissions: | |
| contents: write | |
| packages: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| create-tag: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get latest tag | |
| id: get_latest_tag | |
| run: | | |
| latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT | |
| - name: Create new tag | |
| id: create_tag | |
| run: | | |
| latest_tag=${{ steps.get_latest_tag.outputs.latest_tag }} | |
| # Extract version numbers | |
| major=$(echo $latest_tag | cut -d. -f1 | tr -d 'v') | |
| minor=$(echo $latest_tag | cut -d. -f2) | |
| patch=$(echo $latest_tag | cut -d. -f3) | |
| # Increment patch version | |
| new_patch=$((patch + 1)) | |
| new_tag="v$major.$minor.$new_patch" | |
| echo "new_tag=$new_tag" >> $GITHUB_OUTPUT | |
| - name: Create and push tag | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git tag ${{ steps.create_tag.outputs.new_tag }} | |
| git push origin ${{ steps.create_tag.outputs.new_tag }} | |
| goreleaser: | |
| needs: create-tag | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.21" | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |