Skip to content

Commit 4972371

Browse files
Merge pull request #1715 from forcedotcom/sc/W-17576074
NEW: @W-17576074@: Create github action to make rollback operation of latest tag easy to do
2 parents 73c463e + ef419e5 commit 4972371

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: apply-npm-tag-to-version
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
package_name:
6+
description: 'Select Package Name:'
7+
required: true
8+
type: choice
9+
options:
10+
- '@salesforce/plugin-code-analyzer'
11+
- '@salesforce/sfdx-scanner'
12+
tag_name:
13+
description: 'Tag Name (ex: latest):'
14+
required: true
15+
type: string
16+
version:
17+
description: 'Version (ex: 4.8.0):'
18+
required: true
19+
type: string
20+
confirm:
21+
description: 'Check this box to confirm that you understand that applying a tag using this action is only recommended for emergency rollback situations and that you understand the consequences.'
22+
required: true
23+
type: boolean
24+
25+
jobs:
26+
publish_package:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 'lts/*'
34+
35+
- name: Fail if not confirmed
36+
if: ${{ github.event.inputs.confirm != 'true' }}
37+
run: |
38+
echo "::error::You did not confirm, so dist-tag not called."
39+
exit 1
40+
41+
- name: Validate package name (sanity check)
42+
if: ${{ github.event.inputs.package_name != '@salesforce/plugin-code-analyzer' && github.event.inputs.package_name != '@salesforce/sfdx-scanner' }}
43+
run: |
44+
echo "Invalid package name. Please choose one of the allowed package names."
45+
exit 1
46+
47+
- name: Prepare NPM Credentials
48+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
49+
50+
- name: Apply tag
51+
run: |
52+
echo "You have confirmed that using this action is only recommended for emergency rollback situations and that you are responsible for manually applying the ${{ github.event.inputs.tag_name }} tag to ${{ github.event.inputs.package_name }}@${{ github.event.inputs.version }}."
53+
echo "Applying tag..."
54+
npm dist-tag add ${{ github.event.inputs.package_name }}@${{ github.event.inputs.version }} ${{ github.event.inputs.tag_name }}

0 commit comments

Comments
 (0)