From 7cb0d048c82871e9d5c7e50ff7c24c70d6c9231f Mon Sep 17 00:00:00 2001 From: cb-alish Date: Thu, 2 Jul 2026 10:22:00 +0530 Subject: [PATCH] ci: add manual gem yank workflow Adds a workflow_dispatch workflow to yank (or un-yank) a published chargebee version from RubyGems, reusing the GEM_HOST_API_KEY secret. Requires re-typing the version to confirm to avoid accidental yanks. Co-authored-by: Cursor --- .github/workflows/yank.yml | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/yank.yml diff --git a/.github/workflows/yank.yml b/.github/workflows/yank.yml new file mode 100644 index 0000000..be83be6 --- /dev/null +++ b/.github/workflows/yank.yml @@ -0,0 +1,58 @@ +name: Yank Gem Version + +# Manually yank (or un-yank) a published chargebee version from RubyGems. +# Reuses the GEM_HOST_API_KEY secret already used by the release workflow. +on: + workflow_dispatch: + inputs: + version: + description: "Gem version to yank (e.g. 2.75.0)" + required: true + type: string + confirm: + description: "Re-type the exact version to confirm" + required: true + type: string + undo: + description: "Un-yank instead (re-list a previously yanked version)" + required: false + type: boolean + default: false + +jobs: + yank: + runs-on: ubuntu-latest + env: + VERSION: ${{ inputs.version }} + CONFIRM: ${{ inputs.confirm }} + UNDO: ${{ inputs.undo }} + steps: + - name: Validate inputs + run: | + if [ "$VERSION" != "$CONFIRM" ]; then + echo "❌ Confirmation ('$CONFIRM') does not match version ('$VERSION'). Aborting." + exit 1 + fi + if ! printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z]+)*$'; then + echo "❌ Invalid version format: '$VERSION'" + exit 1 + fi + echo "✅ Inputs valid." + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + + - name: Yank / un-yank gem + env: + GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} + run: | + if [ "$UNDO" = "true" ]; then + echo "↩️ Un-yanking chargebee $VERSION ..." + gem yank chargebee -v "$VERSION" --undo + else + echo "🗑️ Yanking chargebee $VERSION ..." + gem yank chargebee -v "$VERSION" + fi + echo "✅ Done."