Files
Psychotoxical-psysonic/.github/workflows/promote-next-to-release.yml
T
cucadmuh fef13fefd1 Fix/release untagged guard (#399)
* fix(release): prevent untagged fallback from tauri publish

Set explicit github-script output for release_id and validate it before build jobs.
This prevents tauri-action from creating untagged releases when release id wiring
breaks and keeps assets attached to the intended app-v tag release.

* fix(release): add source-only promote mode and harden release binding

Add a source_only dispatch option to promote workflows and propagate it into
channel publish so maintainers can skip platform builds and verify-nix when needed.
Also validate release/tag/commit binding to prevent untagged fallback and ensure
source archives stay aligned with the intended app-v tag.
2026-05-01 21:09:09 +03:00

76 lines
2.8 KiB
YAML

name: Promote next to release
on:
workflow_dispatch:
inputs:
source_only:
description: "Create/refresh tagged release only (skip platform builds and verify-nix)"
required: false
default: false
type: boolean
jobs:
promote:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: release
- name: setup node
uses: actions/setup-node@v5
with:
node-version: lts/*
- name: fast-forward release to next
run: |
set -euo pipefail
git fetch origin next release
# Reset stable channel to next snapshot, then finalize version on top.
git reset --hard origin/next
- name: finalize package version for release
run: |
set -euo pipefail
CURRENT_VERSION="$(node -p 'require("./package.json").version')"
FINAL_VERSION="$(node -p 'const v=require("./package.json").version; const m=v.match(/^(\d+\.\d+\.\d+)/); if(!m){throw new Error("Invalid version: "+v)}; m[1]')"
if [[ "$CURRENT_VERSION" == "$FINAL_VERSION" ]]; then
echo "package.json is already final: $FINAL_VERSION"
exit 0
fi
npm version --no-git-tag-version "$FINAL_VERSION"
- name: sync Tauri version from package.json
run: node scripts/sync-tauri-version-from-package.js
- name: commit final version bump
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json src-tauri/Cargo.toml src-tauri/tauri.conf.json
if git diff --cached --quiet; then
echo "No finalization changes to commit."
exit 0
fi
NEW_VERSION="$(node -p 'require("./package.json").version')"
git commit -m "chore(release): finalize release version ${NEW_VERSION}"
- name: push release
run: git push --force-with-lease origin HEAD:release
- name: dispatch Release Channel workflow
uses: actions/github-script@v7
env:
SOURCE_ONLY: ${{ inputs.source_only && 'true' || 'false' }}
with:
script: |
const sourceOnly = process.env.SOURCE_ONLY === "true";
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "release.yml",
ref: "main",
inputs: {
source_only: sourceOnly ? "true" : "false",
},
});
core.info(`Dispatched release.yml with source_only=${sourceOnly}`);