fix(ci): repair docker build and consolidate CI/release workflows
The pnpm-fetch layer added in #6296 broke the release build: pnpm 11.10.0 applies patchedDependencies during `pnpm fetch`, before node_modules exists, crashing with ENOENT. Install directly from the full context with the store cache mounted instead. Also audit and consolidate the workflows: - standardize action majors (cache@v6, upload-artifact@v7, github-script@v9) - provision Node from mise.toml via jdx/mise-action; drop .nvmrc - rename deployment-docker-image.yml -> deployment-release.yml, reuse the shared setup action, and scope GITHUB_TOKEN permissions per job - extract the duplicated beta/weekly release logic into a reusable deployment-release-pr.yml called by thin triggers
This commit is contained in:
9 files changed
+242
-215
No files matched your search
@@ -0,0 +1,155 @@
|
||||
name: "[Deployment] Release PR (reusable)"
|
||||
|
||||
# Reusable workflow that opens a release PR from `head` into `base`, auto-approves
|
||||
# it and (for non-major bumps) merges it. Used by the beta and weekly release
|
||||
# workflows, which differ only in branch, version suffix and notification wording.
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
release-label:
|
||||
description: 'Human label used in notifications, e.g. "Beta release"'
|
||||
required: true
|
||||
type: string
|
||||
title-prefix:
|
||||
description: 'Text inserted before "release" in the PR title/commit, e.g. "automatic "'
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
version-suffix:
|
||||
description: 'Suffix appended to the computed version, e.g. "-beta"'
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
body-prefix:
|
||||
description: "Extra HTML prepended to the PR body"
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
semver-branch:
|
||||
description: "Branch used to compute the next version"
|
||||
required: true
|
||||
type: string
|
||||
head:
|
||||
description: "PR head branch"
|
||||
required: true
|
||||
type: string
|
||||
base:
|
||||
description: "PR base branch"
|
||||
required: true
|
||||
type: string
|
||||
send-notifications:
|
||||
description: "Whether to send Discord notifications"
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
create-and-merge-pr:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 2
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Discord notification
|
||||
if: inputs.send-notifications
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.4.0
|
||||
with:
|
||||
args: "${{ inputs.release-label }} 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: ${{ inputs.semver-branch }}
|
||||
|
||||
- name: Create pull request
|
||||
id: create-pull-request
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: "${{ steps.semver.outputs.next }}${{ inputs.version-suffix }}"
|
||||
run: >-
|
||||
gh pr create
|
||||
--title "chore(release): ${{ inputs.title-prefix }}release ${VERSION}"
|
||||
--body "${{ inputs.body-prefix }}Detected change to be \`${{ steps.semver.outputs.bump }}\`<br/>Bump version from \`${{ steps.semver.outputs.current }}\` to \`${VERSION}\`"
|
||||
--base ${{ inputs.base }}
|
||||
--head ${{ inputs.head }}
|
||||
--label automerge
|
||||
|
||||
- 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 }}${{ inputs.version-suffix }} (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: ${{ secrets.RENOVATE_APPROVE_APP_ID }}
|
||||
permission-pull-requests: write
|
||||
|
||||
- name: Approve PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.obtainApprovalToken.outputs.token }}
|
||||
run: |
|
||||
gh pr review --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: ${{ secrets.RENOVATE_MERGE_APP_ID }}
|
||||
permission-contents: write # write to the base 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 release branches
|
||||
MERGE_COMMIT_MESSAGE: "chore(release): ${{ inputs.title-prefix }}release ${{ steps.semver.outputs.next }}${{ inputs.version-suffix }}"
|
||||
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 }}${{ inputs.version-suffix }}"
|
||||
|
||||
- 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 }}${{ inputs.version-suffix }}"
|
||||
|
||||
- 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 ${{ inputs.release-label }} workflow [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) has failed"
|
||||
Reference in new issue
Block a user