5.21.0 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Draft release from PR | |
on: | |
#presume that pull_request_target is safe at this point, since the PR was approved and merged | |
#we need write access to prepare the release & create comments | |
pull_request_target: | |
types: | |
- closed | |
branches: | |
- stable | |
- minor-next | |
- major-next | |
- "legacy/*" | |
paths: | |
- "src/VersionInfo.php" | |
jobs: | |
check: | |
name: Check release | |
uses: ./.github/workflows/draft-release-pr-check.yml | |
draft: | |
name: Create GitHub draft release | |
needs: [check] | |
if: needs.check.outputs.valid == 'true' | |
uses: ./.github/workflows/draft-release.yml | |
post-draft-url-comment: | |
name: Post draft release URL as comment | |
needs: [draft] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Post draft release URL on PR | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: "[Draft release ${{ needs.draft.outputs.version }}](${{ needs.draft.outputs.draft-url }}) has been created for commit ${{ github.sha }}. Please review and publish it." | |
trigger-post-release-workflow: | |
name: Trigger post-release RestrictedActions workflow | |
# Not sure if needs is actually needed here | |
needs: [check] | |
if: needs.check.outputs.valid == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Generate access token | |
id: generate-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }} | |
private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }} | |
owner: ${{ github.repository_owner }} | |
repositories: RestrictedActions | |
- name: Dispatch post-release restricted action | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
repository: ${{ github.repository_owner }}/RestrictedActions | |
event-type: pocketmine_mp_post_release | |
client-payload: '{"branch": "${{ github.ref }}"}' |