+12








fcd7c979df
Co-authored-by: Artur <145776561+arturict@users.noreply.github.com> Co-authored-by: arturict <arturict@users.noreply.github.com> Co-authored-by: Thomas <thomas@ajnart.fr> Co-authored-by: Afonso Jorge Ramos <afonsojorgeramos@gmail.com> Co-authored-by: Danura30082 <danura30082+github@gmail.com> Co-authored-by: Kushie <122986913+kushiemoon-dev@users.noreply.github.com> Co-authored-by: ajnart <thomas@ajnart.fr> Co-authored-by: ajnart <thomas@ajnart.dev> Co-authored-by: chenjun <chenjun@foxmail.com> Co-authored-by: Wikibear <wikibear@users.noreply.github.com> Co-authored-by: Bergasha <bergasha@gmail.com> Co-authored-by: leafyelin <43306196+leafyelin@users.noreply.github.com> Co-authored-by: Lucas Araujo <lucas.lra@gmail.com> Co-authored-by: GreenMonito <86085570+GreenMonito@users.noreply.github.com> Co-authored-by: Nerdy-Technician <roffo@nerdy-technician.social> Co-authored-by: Jun <34545896+jcstrong@users.noreply.github.com> Co-authored-by: Edmond Abraham <54119952+gitedmond@users.noreply.github.com> Co-authored-by: thrawnx <tight.bulb9384@fastmail.com> Co-authored-by: Chris <58918656+nordada@users.noreply.github.com> Co-authored-by: yi111 <153097222+Yi-111-a@users.noreply.github.com> Co-authored-by: Yanis <naamaneyanis@gmail.com> Co-authored-by: Wikibear <me@sej.de> Co-authored-by: alessiottavo <93441886+alessiottavo@users.noreply.github.com>
116 lines
5.0 KiB
YAML
116 lines
5.0 KiB
YAML
name: "[Deployment] Beta Release"
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
send-notifications:
|
|
type: boolean
|
|
required: false
|
|
default: true
|
|
description: Send notifications
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
create-and-merge-pr:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Discord notification
|
|
if: ${{ inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@0.4.0
|
|
with:
|
|
args: "Beta release has been triggered: [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Get Next Version
|
|
id: semver
|
|
uses: ietf-tools/semver-action@v1
|
|
with:
|
|
token: ${{ github.token }}
|
|
branch: next
|
|
- name: Create pull request
|
|
id: create-pull-request
|
|
run: |
|
|
pr_url="$(gh pr list --base beta --head next --state open --json url --jq '.[0].url // empty')"
|
|
if [[ -z "$pr_url" ]]; then
|
|
pr_url="$(gh pr create \
|
|
--title "chore(release): release ${{ steps.semver.outputs.next }}-beta" \
|
|
--body "Detected change to be ${{ steps.semver.outputs.bump }}<br/>Bump version from ${{ steps.semver.outputs.current }} to ${{ steps.semver.outputs.next }}-beta" \
|
|
--base beta \
|
|
--head next \
|
|
--label automerge)"
|
|
fi
|
|
echo "url=$pr_url" >> "$GITHUB_OUTPUT"
|
|
echo "pr_number=${pr_url##*/}" >> "$GITHUB_OUTPUT"
|
|
env:
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
- name: Discord notification
|
|
if: ${{ inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@0.4.0
|
|
with:
|
|
args: "Created a release PR ${{ steps.create-pull-request.outputs.url }} for version ${{ steps.semver.outputs.next }}-beta (new behaviour: ${{ steps.semver.outputs.bump }})"
|
|
- name: Obtain token
|
|
id: obtainApprovalToken
|
|
uses: actions/create-github-app-token@v3
|
|
with:
|
|
private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }}
|
|
client-id: ${{ vars.RENOVATE_APPROVE_CLIENT_ID }}
|
|
permission-pull-requests: write
|
|
- name: Approve PR
|
|
env:
|
|
GITHUB_TOKEN: ${{ steps.obtainApprovalToken.outputs.token }}
|
|
run: |
|
|
gh pr review "${{ steps.create-pull-request.outputs.url }}" --approve --body "Automatically approved by GitHub Action"
|
|
- name: Obtain token
|
|
id: obtainMergeToken
|
|
uses: actions/create-github-app-token@v3
|
|
with:
|
|
private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }}
|
|
client-id: ${{ vars.RENOVATE_MERGE_CLIENT_ID }}
|
|
permission-contents: write # write to beta branch (due to merge)
|
|
permission-pull-requests: write # merge pull request
|
|
- id: automerge
|
|
if: ${{ steps.semver.outputs.bump != 'major' }}
|
|
name: automerge
|
|
uses: "pascalgn/automerge-action@v0.16.4"
|
|
env:
|
|
GITHUB_TOKEN: ${{ steps.obtainMergeToken.outputs.token }}
|
|
MERGE_METHOD: merge # we prefer merge commits for merging to beta
|
|
MERGE_COMMIT_MESSAGE: "chore(release): release ${{ steps.semver.outputs.next }}-beta"
|
|
MERGE_DELETE_BRANCH: false # never set to true!
|
|
PULL_REQUEST: "${{ steps.create-pull-request.outputs.pr_number }}"
|
|
MERGE_RETRIES: 20 # 20 retries * MERGE_RETRY_SLEEP until step fails
|
|
MERGE_RETRY_SLEEP: 10000 # 10 seconds * MERGE_RETRIES until step fails
|
|
MERGE_REQUIRED_APPROVALS: 0 # do not require approvals
|
|
|
|
- name: Merged Discord notification
|
|
if: ${{ steps.automerge.outputs.mergeResult == 'merged' && inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@0.4.0
|
|
with:
|
|
args: "Merged PR ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}-beta"
|
|
- name: Major Bump Discord notification
|
|
if: ${{ steps.semver.outputs.bump == 'major' && inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@0.4.0
|
|
with:
|
|
args: "The release PR must be manually merged because the next version is a major version: ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}-beta"
|
|
- name: Discord Fail Notification
|
|
if: ${{ failure() && inputs.send-notifications }}
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
uses: Ilshidur/action-discord@0.4.0
|
|
with:
|
|
args: "The beta release workflow [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) has failed"
|