|
| 1 | +name: Prepare Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: prepare-release |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + prepare: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + if: "!startsWith(github.event.head_commit.message, 'chore(release):')" |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Setup Node.js |
| 28 | + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 |
| 29 | + with: |
| 30 | + node-version: '24' |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + run: npm install |
| 34 | + |
| 35 | + - name: Build |
| 36 | + run: npm run build |
| 37 | + |
| 38 | + - name: Detect Next Version |
| 39 | + id: version |
| 40 | + run: | |
| 41 | + # Run semantic-release with only commit analyzer to detect version |
| 42 | + NEXT_VERSION=$(npx semantic-release --dry-run --plugins @semantic-release/commit-analyzer | tee /dev/stderr | awk '/The next release version is/{print $NF}') |
| 43 | + echo "next=$NEXT_VERSION" >> $GITHUB_OUTPUT |
| 44 | +
|
| 45 | + - name: Update package.json |
| 46 | + if: steps.version.outputs.next != '' |
| 47 | + run: npm version "${{ steps.version.outputs.next }}" --no-git-tag-version |
| 48 | + |
| 49 | + - name: Update CHANGELOG.md |
| 50 | + if: steps.version.outputs.next != '' |
| 51 | + run: npx conventional-changelog-cli -p angular -i CHANGELOG.md -s |
| 52 | + |
| 53 | + - name: Create Pull Request |
| 54 | + if: steps.version.outputs.next != '' |
| 55 | + uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 |
| 56 | + with: |
| 57 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + commit-message: "chore(release): ${{ steps.version.outputs.next }}" |
| 59 | + branch: "release/v${{ steps.version.outputs.next }}" |
| 60 | + delete-branch: true |
| 61 | + title: "chore(release): ${{ steps.version.outputs.next }}" |
| 62 | + body: | |
| 63 | + This PR prepares the release of version ${{ steps.version.outputs.next }}. |
| 64 | +
|
| 65 | + **Changes:** |
| 66 | + - Updated version in `package.json` to ${{ steps.version.outputs.next }} |
| 67 | + - Updated `CHANGELOG.md` with release notes |
| 68 | +
|
| 69 | + **Next Steps:** |
| 70 | + Review and merge this PR to trigger the publish workflow. |
| 71 | + labels: release |
0 commit comments