diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69c4bd3..1a3bc6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ on: push: - # Sequence of patterns matched against refs/tags - # tags: - # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + # Only trigger the workflow for tag pushes + tags: + - 'v*' # Trigger for tags like v1.0, v20.15.10 name: Latest Release @@ -14,26 +14,15 @@ defaults: shell: bash jobs: - # test: - # name: Run tests - # runs-on: 'ubuntu-latest' - # needs: lint - # steps: - # - uses: actions/checkout@v2 - # - uses: actions/setup-go@v2 - # with: - # go-version: '1.22.x' - # - run: go test -v -cover release: name: Create Release runs-on: 'ubuntu-latest' - # needs: test strategy: matrix: - # List of GOOS and GOARCH pairs from `go tool dist list` goosarch: - "linux/amd64" - # etc + # Add other GOOS/GOARCH combinations if needed + if: startsWith(github.ref, 'refs/tags/') # Ensure this job runs only for tag pushes steps: - name: Checkout code uses: actions/checkout@v2 @@ -58,10 +47,11 @@ jobs: run: git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md" - name: Release with Notes + if: success() # Proceed with release only if previous steps were successful uses: softprops/action-gh-release@v1 with: body_path: ".github/RELEASE-TEMPLATE.md" draft: false files: ${{env.BINARY_NAME}} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}