diff --git a/.github/workflows/tag_and_release.yml b/.github/workflows/add_tag.yml similarity index 59% rename from .github/workflows/tag_and_release.yml rename to .github/workflows/add_tag.yml index b9040c0..2abd91f 100644 --- a/.github/workflows/tag_and_release.yml +++ b/.github/workflows/add_tag.yml @@ -48,40 +48,3 @@ jobs: tag: ${{ needs.release_commit_check.outputs.new_version }} commit_sha: ${{ github.sha }} github_token: ${{ secrets.GITHUB_TOKEN }} - - draft_changelog: - runs-on: ubuntu-latest - needs: [add_version, release_commit_check] - outputs: - release_body: ${{ steps.git_cliff.outputs.content }} - steps: - - name: Checkout Repository at Tagged Commit - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ needs.release_commit_check.outputs.new_version }} - - name: Generate Changelog - id: git_cliff - uses: orhun/git-cliff-action@v4 - with: - args: --latest --verbose - env: - GITHUB_REPO: ${{ github.repository }} - - create_github_release: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: read - needs: [release_commit_check, draft_changelog] - steps: - - name: Create Release - uses: softprops/action-gh-release@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - name: ${{ needs.release_commit_check.outputs.new_version }} - body: | - ${{ needs.draft_changelog.outputs.release_body }} - draft: false - prerelease: false diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 0000000..6cf097c --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,58 @@ +name: Create Release + +on: + push: + tags: '\d+.\d+.\d+' + +jobs: + on-main-branch-check: + runs-on: ubuntu-latest + outputs: + on_main: ${{ steps.contains_tag.outputs.retval }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: rickstaa/action-contains-tag@v1 + id: contains_tag + with: + reference: "main" + tag: "${{ github.ref_name }}" + + draft_changelog: + runs-on: ubuntu-latest + needs: on-main-branch-check + if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }} + outputs: + release_body: ${{ steps.git_cliff.outputs.content }} + steps: + - name: Checkout Repository at Tagged Commit + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.ref_name }} + - name: Generate Changelog + id: git_cliff + uses: orhun/git-cliff-action@v4 + with: + args: --latest --verbose + env: + GITHUB_REPO: ${{ github.repository }} + + create_github_release: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + needs: draft_changelog + steps: + - name: Create Release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: ${{ github.ref_name }} + body: | + ${{ needs.draft_changelog.outputs.release_body }} + draft: false + prerelease: false