|
| 1 | +name: Update release metadata |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + release_type: |
| 7 | + description: Release type |
| 8 | + type: string |
| 9 | + default: auto |
| 10 | + custom_version: |
| 11 | + description: The custom version to bump to (only for "custom" type) |
| 12 | + type: string |
| 13 | + default: '' |
| 14 | + outputs: |
| 15 | + version_number: |
| 16 | + description: The version number for the release |
| 17 | + value: ${{ jobs.release_metadata.outputs.version_number }} |
| 18 | + tag_name: |
| 19 | + description: The tag name for the release |
| 20 | + value: ${{ jobs.release_metadata.outputs.tag_name }} |
| 21 | + changelog: |
| 22 | + description: The full changelog content |
| 23 | + value: ${{ jobs.release_metadata.outputs.changelog }} |
| 24 | + release_notes: |
| 25 | + description: The release notes for this version |
| 26 | + value: ${{ jobs.release_metadata.outputs.release_notes }} |
| 27 | + changelog_commitish: |
| 28 | + description: The commit SHA after changelog update |
| 29 | + value: ${{ jobs.update_changelog.outputs.changelog_commitish }} |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: write |
| 33 | + |
| 34 | +jobs: |
| 35 | + release_metadata: |
| 36 | + name: Prepare release metadata |
| 37 | + runs-on: ubuntu-latest |
| 38 | + outputs: |
| 39 | + version_number: ${{ steps.release_metadata.outputs.version_number }} |
| 40 | + tag_name: ${{ steps.release_metadata.outputs.tag_name }} |
| 41 | + changelog: ${{ steps.release_metadata.outputs.changelog }} |
| 42 | + release_notes: ${{ steps.release_metadata.outputs.release_notes }} |
| 43 | + steps: |
| 44 | + - uses: apify/workflows/git-cliff-release@main |
| 45 | + name: Prepare release metadata |
| 46 | + id: release_metadata |
| 47 | + with: |
| 48 | + release_type: ${{ inputs.release_type }} |
| 49 | + custom_version: ${{ inputs.custom_version }} |
| 50 | + existing_changelog_path: CHANGELOG.md |
| 51 | + token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} |
| 52 | + |
| 53 | + update_changelog: |
| 54 | + needs: [release_metadata] |
| 55 | + name: Update changelog |
| 56 | + runs-on: ubuntu-latest |
| 57 | + outputs: |
| 58 | + changelog_commitish: ${{ steps.commit.outputs.commit_long_sha || github.sha }} |
| 59 | + steps: |
| 60 | + - name: Checkout repository |
| 61 | + uses: actions/checkout@v6 |
| 62 | + with: |
| 63 | + token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} |
| 64 | + |
| 65 | + - name: Use Node.js |
| 66 | + uses: actions/setup-node@v6 |
| 67 | + with: |
| 68 | + node-version: 24 |
| 69 | + |
| 70 | + - name: Update package version |
| 71 | + run: npm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }} |
| 72 | + |
| 73 | + - name: Update changelog |
| 74 | + uses: DamianReeves/write-file-action@master |
| 75 | + with: |
| 76 | + path: CHANGELOG.md |
| 77 | + write-mode: overwrite |
| 78 | + contents: ${{ needs.release_metadata.outputs.changelog }} |
| 79 | + |
| 80 | + - name: Commit changes |
| 81 | + id: commit |
| 82 | + uses: EndBug/add-and-commit@v9 |
| 83 | + with: |
| 84 | + author_name: Apify Release Bot |
| 85 | + author_email: noreply@apify.com |
| 86 | + message: 'chore(release): Update changelog and package version [skip ci]' |
0 commit comments