Skip to content

Commit 178a652

Browse files
authored
Update pre-release workflow to use supported version tags (#133)
1 parent ad495e0 commit 178a652

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,38 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
15-
16-
- name: Install Node.js
17-
uses: actions/setup-node@v4
18-
with:
19-
node-version: 18.x
20-
21-
- name: Install Dependencies
22-
run: npm ci
23-
24-
- name: Install VSCE
25-
run: npm install -g vsce
26-
27-
- name: Update package version and version default in package.json
28-
run: |
29-
TAG_NAME=${{ github.ref_name }}
30-
VERSION=${TAG_NAME#v}
31-
if [[ "$TAG_NAME" == *"-beta"* ]]; then
32-
jq --arg version "$VERSION" --arg default "beta" '.version = $version | .contributes.configuration.properties["dev-proxy-toolkit.version"].default = $default' package.json > package.tmp.json
33-
else
34-
jq --arg version "$VERSION" '.version = $version' package.json > package.tmp.json
35-
fi
36-
mv package.tmp.json package.json
37-
38-
- name: Publish
39-
env:
40-
VSCE_PAT: ${{ secrets.VSCE_PAT }}
41-
run: |
42-
TAG_NAME=${{ github.ref_name }}
43-
if [[ "$TAG_NAME" == *"-beta"* ]]; then
44-
vsce publish --pre-release
45-
else
46-
vsce publish
47-
fi
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Install Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 18.x
20+
21+
- name: Install Dependencies
22+
run: npm ci
23+
24+
- name: Install VSCE
25+
run: npm install -g vsce
26+
27+
- name: Update version and default in package.json
28+
run: |
29+
TAG_NAME=${{ github.ref_name }}
30+
VERSION=${TAG_NAME#v}
31+
VERSION=${VERSION%-beta}
32+
if [[ "$TAG_NAME" == *"-beta"* ]]; then
33+
jq --arg version "$VERSION" --arg default "beta" '.version = $version | .contributes.configuration.properties["dev-proxy-toolkit.version"].default = $default' package.json > package.tmp.json
34+
else
35+
jq --arg version "$VERSION" --arg default "stable" '.version = $version | .contributes.configuration.properties["dev-proxy-toolkit.version"].default = $default' package.json > package.tmp.json
36+
fi
37+
mv package.tmp.json package.json
38+
39+
- name: Publish
40+
env:
41+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
42+
run: |
43+
if [[ "$TAG_NAME" == *"-beta"* ]]; then
44+
vsce publish --pre-release
45+
else
46+
vsce publish
47+
fi

0 commit comments

Comments
 (0)