diff --git a/.github/release-drafter_extension.yml b/.github/release-drafter_extension.yml new file mode 100644 index 0000000..a0e82d9 --- /dev/null +++ b/.github/release-drafter_extension.yml @@ -0,0 +1,25 @@ +name-template: "Release $COMPLETE" +tag-template: "v$COMPLETE" + +exclude: + pulls: true +exclude-labels: + - prod-merge + - stage-merge + +categories: + - title: "Features" + labels: ["feature", "enhancement"] + - title: "Fixes" + labels: ["bug"] + - title: "Maintenance" + labels: ["chore", "refactor"] + +change-template: "- $TITLE [#$NUMBER]" + +template: | + # Release $COMPLETE + + ## Changes + + $CHANGES diff --git a/.github/release-drafter.yml b/.github/release-drafter_github.yml similarity index 71% rename from .github/release-drafter.yml rename to .github/release-drafter_github.yml index 2e4b7f4..a33f24e 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter_github.yml @@ -1,8 +1,11 @@ -name-template: "Release $NEXT_PATCH_VERSION" -tag-template: "v$NEXT_PATCH_VERSION" +name-template: "Release $COMPLETE" +tag-template: "v$COMPLETE" exclude: pulls: true +exclude-labels: + - prod-merge + - stage-merge categories: - title: "Features" @@ -15,8 +18,6 @@ categories: change-template: "- $TITLE ([#$NUMBER]($URL))" template: | - # Release $NEXT_PATCH_VERSION - ## Changes $CHANGES diff --git a/.github/workflows/autolabel.yaml b/.github/workflows/autolabel.yaml new file mode 100644 index 0000000..bec469a --- /dev/null +++ b/.github/workflows/autolabel.yaml @@ -0,0 +1,31 @@ +name: Auto-label PRs + +on: + pull_request: + types: [opened, reopened, synchronize, edited] + +jobs: + label-stage-to-prod: + runs-on: ubuntu-latest + steps: + - name: Label PRs + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const base = context.payload.pull_request.base.ref; + const head = context.payload.pull_request.head.ref; + + if (base === 'sportsmanager2-prod' && head === 'sportsmanager2-stage') { + await github.rest.issues.addLabels({ + ...context.repo, + issue_number: context.payload.pull_request.number, + labels: ['prod-merge'] + }); + } else if (base === 'sportsmanager2-stage' && head === 'sportsmanager2-dev') { + await github.rest.issues.addLabels({ + ...context.repo, + issue_number: context.payload.pull_request.number, + labels: ['stage-merge'] + }); + } diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 77fad19..5b82a1b 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -26,20 +26,32 @@ jobs: run: npm ci - name: Generate release notes - id: release_notes + id: release_notes_extension uses: release-drafter/release-drafter@v6 with: - config-name: release-drafter.yml + config-name: release-drafter_extension.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Save release notes to file run: | - echo "${{ steps.release_notes.outputs.body }}" > RELEASE_NOTES.md + echo "${{ steps.release_notes_extension.outputs.body }}" > RELEASE_NOTES.md - name: Run build script run: npm run release + - name: Generate release notes + id: release_notes_github + uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter_github.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Save release notes to file + run: | + echo "${{ steps.release_notes_github.outputs.body }}" > RELEASE_NOTES.md + - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: