From b4f66e6cce8256227a4cc376c02436104de38bbe Mon Sep 17 00:00:00 2001 From: bash0816 Date: Sat, 22 Aug 2026 12:43:13 +0900 Subject: [PATCH] ci: add Rollback magi-server Staging workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @stagingにも@latestと同様の緊急ロールバック手段がなかったため追加。 rollback-latest.ymlと同じnpm-publish environment(承認必須)を通す。 Co-Authored-By: Claude Sonnet 5 --- .github/workflows/rollback-staging.yml | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/rollback-staging.yml diff --git a/.github/workflows/rollback-staging.yml b/.github/workflows/rollback-staging.yml new file mode 100644 index 0000000..f263165 --- /dev/null +++ b/.github/workflows/rollback-staging.yml @@ -0,0 +1,44 @@ +name: Rollback magi-server Staging + +on: + workflow_dispatch: + inputs: + version: + description: "Version to rollback @staging to (e.g. 0.35.2)" + required: true + type: string + reason: + description: "Reason for rollback (audit log)" + required: true + type: string + +concurrency: + group: npm-publish-magi-server + cancel-in-progress: false + +jobs: + rollback: + runs-on: ubuntu-latest + environment: npm-publish + steps: + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: "22" + registry-url: "https://registry.npmjs.org" + + - name: Rollback @staging + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + VERSION: ${{ inputs.version }} + REASON: ${{ inputs.reason }} + run: | + echo "$VERSION" | grep -qE '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$' \ + || { echo "::error::Invalid semver: $VERSION"; exit 1; } + + FOUND=$(npm view "@bash0816/magi-server@${VERSION}" version 2>/dev/null || true) + [ "$FOUND" = "$VERSION" ] \ + || { echo "::error::$VERSION not found on npm registry"; exit 1; } + + echo "ROLLBACK: reason=$REASON target=$VERSION" + npm dist-tag add "@bash0816/magi-server@${VERSION}" staging + echo "Rolled back @bash0816/magi-server @staging → $VERSION"