-
-
Notifications
You must be signed in to change notification settings - Fork 20
chore(release): adopt shared forensic release pipeline #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Caller stub: release preparation (stage 1). | ||
| # | ||
| # The workflow_run trigger cannot live in the reusable workflow, so it lives | ||
| # here. The single job forwards the tested commit (or a manually dispatched SHA) | ||
| # to the reusable prepare workflow, which re-confirms the SHA is still the | ||
| # default-branch head and opens/refreshes the standing release PR. | ||
| # | ||
| # Escape hatch: workflow_dispatch lets you plan manually (e.g. a dry-run smoke | ||
| # test before your first release) without waiting for a CI completion. | ||
|
|
||
| name: Prepare release | ||
|
|
||
| on: | ||
| workflow_run: | ||
| # Must match the name: of this repo's CI workflow (ci.yml is "CI"). | ||
| workflows: ["CI"] | ||
| types: [completed] | ||
| workflow_dispatch: | ||
| inputs: | ||
| targetSha: | ||
| description: "Commit SHA to plan from (defaults to the default-branch head)" | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: release-prepare | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| prepare: | ||
| # Manual dispatch always runs; the automatic path only runs for a green | ||
| # CI run from a push to the default branch. | ||
| if: >- | ||
| github.event_name == 'workflow_dispatch' || | ||
| (github.event.workflow_run.conclusion == 'success' && | ||
| github.event.workflow_run.event == 'push' && | ||
| github.event.workflow_run.head_branch == 'master') | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| uses: chhoumann/obsidian-plugin-workflows/.github/workflows/release-prepare.yml@v2 | ||
| with: | ||
| plugin-name: metaedit | ||
| package-manager: pnpm | ||
| default-branch: master | ||
| node-version: "24" | ||
| target-sha: ${{ github.event.workflow_run.head_sha || inputs.targetSha }} | ||
| release-bot-app-slug: metaedit-release-bot | ||
| app-id: ${{ vars.RELEASE_APP_ID }} | ||
| workflows-ref: v2 | ||
| # dry-run: true # plan only; skip opening the PR (smoke test) | ||
| secrets: | ||
| release-app-private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Caller stub: release trigger (stage 2). | ||
| # | ||
| # pull_request_target cannot live in the reusable workflow, so it lives here. | ||
| # The instant a release PR merges, this forwards the PR number to the reusable | ||
| # validate workflow, which performs the full merged-PR forensics and dispatches | ||
| # the release. The workflow never checks out PR head code, so pull_request_target | ||
| # is safe here. | ||
|
|
||
| name: Trigger release | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [closed] | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: release-trigger | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| validate: | ||
| if: >- | ||
| github.event.pull_request.merged == true && | ||
| github.event.pull_request.base.ref == 'master' && | ||
| startsWith(github.event.pull_request.head.ref, 'release/') | ||
| permissions: | ||
| actions: write | ||
| contents: write | ||
| pull-requests: read | ||
| uses: chhoumann/obsidian-plugin-workflows/.github/workflows/release-validate.yml@v2 | ||
| with: | ||
| pr-number: ${{ github.event.pull_request.number }} | ||
| plugin-name: metaedit | ||
| package-manager: pnpm | ||
| default-branch: master | ||
| release-bot-app-slug: metaedit-release-bot | ||
| release-workflow: release.yml |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,50 @@ | ||
| # Caller stub: release (stage 3). | ||
| # | ||
| # workflow_dispatch is the only trigger: the reusable validate workflow (stage 2) | ||
| # dispatches this on the durable release-run/<version> recovery branch. Keeping a | ||
| # plain workflow_dispatch here also makes the release itself replayable for | ||
| # recovery without re-running the whole pipeline. | ||
|
|
||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| releasePr: | ||
| description: "Merged machine-generated release PR number to recover" | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.ref }} | ||
| group: release | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| actions: read | ||
| attestations: write | ||
| contents: write | ||
| issues: write # semantic-release success comments | ||
| pull-requests: write # semantic-release success comments | ||
| steps: | ||
| - name: Harden Runner | ||
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | ||
| with: | ||
| egress-policy: audit | ||
| - name: Checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| # Full history + tags so semantic-release can compute the next version. | ||
| fetch-depth: 0 | ||
| # semantic-release manages its own push auth via GITHUB_TOKEN; keep | ||
| # the checkout token out of the git config. | ||
| persist-credentials: false | ||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | ||
| - name: Use Node.js 24 | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| check-latest: true | ||
| cache: pnpm | ||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
| - name: Build | ||
| run: pnpm run build | ||
| - name: Run tests | ||
| run: pnpm run test | ||
| - name: Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: pnpm semantic-release | ||
| id-token: write | ||
| pull-requests: read | ||
| uses: chhoumann/obsidian-plugin-workflows/.github/workflows/release.yml@v2 | ||
| with: | ||
| release-pr: ${{ inputs.releasePr }} | ||
| plugin-name: metaedit | ||
| package-manager: pnpm | ||
| default-branch: master | ||
| node-version: "24" | ||
| release-bot-app-slug: metaedit-release-bot | ||
| release-assets: '["main.js","manifest.json","styles.css"]' | ||
| build-command: pnpm run build | ||
| verify-commands: | | ||
| pnpm run lint | ||
| pnpm run typecheck | ||
| pnpm run test | ||
| workflows-ref: v2 | ||
| secrets: | ||
| # Optional: unset secrets resolve to '' and the notify job skips them. | ||
| slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | ||
| discord-webhook: ${{ secrets.DISCORD_WEBHOOK }} |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.