diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f23522..f4eba0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,8 @@ name: release on: push: - # Sequence of patterns matched against refs/tags + branches: + - main tags: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 @@ -14,8 +15,27 @@ permissions: contents: write jobs: + version: + name: Generate Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Generate Version + id: version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + default_bump: patch + release_branches: main + build: name: Build + needs: version runs-on: ${{ matrix.os }} strategy: matrix: @@ -86,9 +106,9 @@ jobs: release: name: Create Release - needs: build + needs: [build, version] runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' steps: - name: Download all artifacts @@ -97,6 +117,8 @@ jobs: - name: Create Release uses: softprops/action-gh-release@v1 with: + tag_name: v${{ needs.version.outputs.version }} + name: Release v${{ needs.version.outputs.version }} files: | popcorn-cli-linux.tar.gz/popcorn-cli-linux.tar.gz popcorn-cli-windows.zip/popcorn-cli-windows.zip