Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/rollback-staging.yml
Original file line number Diff line number Diff line change
@@ -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"
Loading