Skip to content

Commit b5dc7dd

Browse files
authored
chore: support dry-run mode (#184)
1 parent b0fbc91 commit b5dc7dd

File tree

1 file changed

+47
-9
lines changed

1 file changed

+47
-9
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
description: 'Branch to release'
88
required: true
99
default: 'main'
10+
dry_run:
11+
type: boolean
12+
description: 'Run the workflow in dry-run mode'
13+
required: false
14+
default: false
1015
npm_tag:
1116
type: choice
1217
description: 'Specify npm tag'
@@ -42,10 +47,20 @@ env:
4247
jobs:
4348
publish-npm:
4449
if: ${{ inputs.to_release == 'all' || inputs.to_release == 'npm' }}
45-
name: Publish NPM Packages and
50+
name: ${{ inputs.dry_run == true && 'Dry Run - NPM Packages' || 'Publish NPM Packages' }}
4651
needs: [build, check]
4752
runs-on: rspack-ubuntu-22.04-large
4853
steps:
54+
- name: Show dry-run status
55+
run: |
56+
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
57+
echo "🏃‍♂️ RUNNING IN DRY-RUN MODE - No packages will be published to npm registry"
58+
echo "=================================================="
59+
else
60+
echo "🚀 LIVE MODE - Packages will be published to npm registry"
61+
echo "========================================"
62+
fi
63+
4964
- name: Checkout
5065
uses: actions/checkout@v4
5166
with:
@@ -73,6 +88,7 @@ jobs:
7388
uses: ./.github/actions/move-artifacts
7489

7590
- name: Publish npm packages
91+
if: ${{ github.event.inputs.dry_run == false }}
7692
env:
7793
NPM_TOKEN: ${{ secrets.RSLINT_NPM_TOKEN }}
7894
run: |
@@ -81,7 +97,7 @@ jobs:
8197
8298
publish-extesion:
8399
if: ${{ inputs.to_release == 'all' || inputs.to_release == 'extension' }}
84-
name: Publish Extensions
100+
name: ${{ inputs.dry_run == true && 'Dry Run - Extensions' || 'Publish Extensions' }}
85101
needs: [build, check]
86102
runs-on: rspack-ubuntu-22.04-large
87103
steps:
@@ -112,26 +128,48 @@ jobs:
112128
env:
113129
VSCE_PAT: ${{ secrets.RSLINT_VSCE_PAT }}
114130
run: |
115-
if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then
116-
pnpm publish:vsce --prerelease
131+
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
132+
echo "🚀 DRY RUN: Building and packaging VS Code extension without publishing..."
133+
if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then
134+
pnpm publish:vsce --prerelease --dry-run
135+
else
136+
pnpm publish:vsce --dry-run
137+
fi
117138
else
118-
pnpm publish:vsce
139+
if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then
140+
pnpm publish:vsce --prerelease
141+
else
142+
pnpm publish:vsce
143+
fi
119144
fi
120-
145+
- name: Upload VSCE artifact
146+
uses: actions/upload-artifact@v4
147+
with:
148+
path: packages/vscode-extension/rslint-*.vsix
121149
- name: Build and publish to Open VSX Registry
122150
# TODO fix the timeout problem while publish to Open VSX Registry
123151
if: false
124152
env:
125153
OVSX_PAT: ${{ secrets.RSLINT_OVSX_PAT }}
126154
run: |
127-
if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then
128-
pnpm publish:ovsx --prerelease
155+
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
156+
echo "🚀 DRY RUN: Building and packaging for Open VSX Registry without publishing..."
157+
if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then
158+
pnpm publish:ovsx --prerelease --dry-run
159+
else
160+
pnpm publish:ovsx --dry-run
161+
fi
129162
else
130-
pnpm publish:ovsx
163+
if [ "${{ github.event.inputs.extension_type }}" = "pre-release" ]; then
164+
pnpm publish:ovsx --prerelease
165+
else
166+
pnpm publish:ovsx
167+
fi
131168
fi
132169
133170
check:
134171
name: Test
172+
if: ${{ github.event.inputs.dry_run == false }}
135173
needs: build
136174
strategy:
137175
fail-fast: true

0 commit comments

Comments
 (0)