|
| 1 | +# Workflow: Release |
| 2 | +# Description: Generates a release tag and GitHub release |
| 3 | +# Why: Provides versioned releases for production deployments |
| 4 | + |
| 5 | +name: Create Release |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + create-release: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + outputs: |
| 17 | + released: ${{ steps.changelog.outputs.skipped == 'false' }} |
| 18 | + tag: ${{ steps.changelog.outputs.tag }} |
| 19 | + steps: |
| 20 | + - name: Checkout Repository |
| 21 | + uses: actions/checkout@v6 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Conventional Changelog Action |
| 26 | + id: changelog |
| 27 | + uses: TriPSs/conventional-changelog-action@v5 |
| 28 | + with: |
| 29 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + git-user-name: 'github-actions[bot]' |
| 31 | + git-user-email: 'github-actions[bot]@users.noreply.github.com' |
| 32 | + git-message: 'chore(release): {version}' |
| 33 | + preset: 'angular' |
| 34 | + tag-prefix: 'v' |
| 35 | + version-file: 'package.json' |
| 36 | + skip-on-empty: 'false' |
| 37 | + skip-ci: 'true' |
| 38 | + create-summary: 'true' |
| 39 | + git-push: 'false' |
| 40 | + release-count: 0 |
| 41 | + |
| 42 | + - name: Commit release artifacts |
| 43 | + if: ${{ steps.changelog.outputs.skipped == 'false' }} |
| 44 | + run: | |
| 45 | + git config user.name 'github-actions[bot]' |
| 46 | + git config user.email 'github-actions[bot]@users.noreply.github.com' |
| 47 | + git add package.json |
| 48 | + git tag -d "${{ steps.changelog.outputs.tag }}" 2>/dev/null || true |
| 49 | + git commit -m "chore(release): ${{ steps.changelog.outputs.tag }}" |
| 50 | + git tag "${{ steps.changelog.outputs.tag }}" |
| 51 | + git push origin HEAD:main --tags |
| 52 | +
|
| 53 | + - name: Create GitHub Release |
| 54 | + if: ${{ steps.changelog.outputs.skipped == 'false' }} |
| 55 | + uses: softprops/action-gh-release@v2 |
| 56 | + with: |
| 57 | + tag_name: ${{ steps.changelog.outputs.tag }} |
| 58 | + name: ${{ steps.changelog.outputs.tag }} |
| 59 | + body: ${{ steps.changelog.outputs.clean_changelog }} |
| 60 | + prerelease: false |
0 commit comments