|
| 1 | +name: "Shared auto release" |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + prerelease: |
| 6 | + description: "Boolean indicating whether this release should be a prerelease" |
| 7 | + required: false |
| 8 | + default: false |
| 9 | + type: string |
| 10 | + publish: |
| 11 | + description: "Whether to publish a new release immediately" |
| 12 | + required: false |
| 13 | + default: false |
| 14 | + type: string |
| 15 | + runs-on: |
| 16 | + description: "Overrides job runs-on setting (json-encoded list)" |
| 17 | + type: string |
| 18 | + required: false |
| 19 | + default: '["ubuntu-latest"]' |
| 20 | + summary-enabled: |
| 21 | + description: Enable github action summary. |
| 22 | + required: false |
| 23 | + default: true |
| 24 | + type: boolean |
| 25 | + |
| 26 | + outputs: |
| 27 | + id: |
| 28 | + description: The ID of the release that was created or updated. |
| 29 | + value: ${{ jobs.release.outputs.id }} |
| 30 | + name: |
| 31 | + description: The name of the release |
| 32 | + value: ${{ jobs.release.outputs.name }} |
| 33 | + tag_name: |
| 34 | + description: The name of the tag associated with the release. |
| 35 | + value: ${{ jobs.release.outputs.tag_name }} |
| 36 | + body: |
| 37 | + description: The body of the drafted release. |
| 38 | + value: ${{ jobs.release.outputs.body }} |
| 39 | + html_url: |
| 40 | + description: The URL users can navigate to in order to view the release |
| 41 | + value: ${{ jobs.release.outputs.html_url }} |
| 42 | + upload_url: |
| 43 | + description: The URL for uploading assets to the release, which could be used by GitHub Actions for additional uses, for example the @actions/upload-release-asset GitHub Action. |
| 44 | + value: ${{ jobs.release.outputs.upload_url }} |
| 45 | + major_version: |
| 46 | + description: The next major version number. For example, if the last tag or release was v1.2.3, the value would be v2.0.0. |
| 47 | + value: ${{ jobs.release.outputs.major_version }} |
| 48 | + minor_version: |
| 49 | + description: The next minor version number. For example, if the last tag or release was v1.2.3, the value would be v1.3.0. |
| 50 | + value: ${{ jobs.release.outputs.minor_version }} |
| 51 | + patch_version: |
| 52 | + description: The next patch version number. For example, if the last tag or release was v1.2.3, the value would be v1.2.4. |
| 53 | + value: ${{ jobs.release.outputs.patch_version }} |
| 54 | + resolved_version: |
| 55 | + description: The next resolved version number, based on GitHub labels. |
| 56 | + value: ${{ jobs.release.outputs.resolved_version }} |
| 57 | + exists: |
| 58 | + description: Tag exists so skip new release issue |
| 59 | + value: ${{ jobs.release.outputs.exists }} |
| 60 | + |
| 61 | +permissions: {} |
| 62 | + |
| 63 | +jobs: |
| 64 | + release: |
| 65 | + runs-on: ${{ fromJSON(inputs.runs-on) }} |
| 66 | + environment: release |
| 67 | + outputs: |
| 68 | + id: ${{ steps.drafter.outputs.id }} |
| 69 | + name: ${{ steps.drafter.outputs.name }} |
| 70 | + tag_name: ${{ steps.drafter.outputs.tag_name }} |
| 71 | + body: ${{ steps.drafter.outputs.body }} |
| 72 | + html_url: ${{ steps.drafter.outputs.html_url }} |
| 73 | + upload_url: ${{ steps.drafter.outputs.upload_url }} |
| 74 | + major_version: ${{ steps.drafter.outputs.major_version }} |
| 75 | + minor_version: ${{ steps.drafter.outputs.minor_version }} |
| 76 | + patch_version: ${{ steps.drafter.outputs.patch_version }} |
| 77 | + resolved_version: ${{ steps.drafter.outputs.resolved_version }} |
| 78 | + exists: ${{ steps.drafter.outputs.exists }} |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/create-github-app-token@v1 |
| 82 | + id: github-app |
| 83 | + with: |
| 84 | + app-id: ${{ vars.BOT_GITHUB_APP_ID }} |
| 85 | + private-key: ${{ secrets.BOT_GITHUB_APP_PRIVATE_KEY }} |
| 86 | + |
| 87 | + - name: Context |
| 88 | + id: context |
| 89 | + uses: cloudposse/[email protected] |
| 90 | + with: |
| 91 | + query: .${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} |
| 92 | + config: |- |
| 93 | + true: |
| 94 | + config: auto-release.yml |
| 95 | + latest: true |
| 96 | + false: |
| 97 | + config: auto-release-hotfix.yml |
| 98 | + latest: false |
| 99 | +
|
| 100 | + # Drafts your next Release notes as Pull Requests are merged into "main" |
| 101 | + - uses: cloudposse/github-action-auto-release@fix-release-summary |
| 102 | + id: drafter |
| 103 | + with: |
| 104 | + token: ${{ steps.github-app.outputs.token }} |
| 105 | + publish: ${{ inputs.publish }} |
| 106 | + prerelease: ${{ inputs.prerelease }} |
| 107 | + latest: ${{ steps.context.outputs.latest }} |
| 108 | + summary-enabled: ${{ inputs.summary-enabled }} |
| 109 | + config-name: ${{ steps.context.outputs.config }} |
0 commit comments