Skip to content

Commit c0e96af

Browse files
committed
Add GitHub releases to publish workflow
1 parent 1213a22 commit c0e96af

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

.github/workflows/publish pre-release.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@master
1818

19-
- name: Install Dependencies
20-
run: |
19+
- name: Install Dependencies # vsce etc
20+
run: | # shell
2121
npm i
22-
npm i @vscode/vsce -g
2322
24-
- name: Build Extension
25-
run: npm run build
23+
- name: Build Extension # build `extension.js` and `*.wasm` files
24+
run: | # shell
25+
npm run build
2626
27-
- name: Setup Github Actions
28-
run: |
27+
- name: Setup Github Actions # allow use of `git push`
28+
run: | # shell
2929
git config --global user.name "RedCMD"
3030
git config --global user.email "[email protected]"
3131
git add .
3232
git diff-index --quiet HEAD || git commit -m "Sync Github Actions"
3333
34-
- name: Publish Pre-release
35-
run: |
36-
vsce publish patch --pre-release -p ${{ secrets.VSCE_PAT }}
37-
git push
34+
- name: Publish Pre-release # upload to Extension Marketplace
35+
run: | # shell
36+
npx vsce publish patch --pre-release -p ${{ secrets.VSCE_PAT }}
37+
git push --follow-tags

.github/workflows/publish.yml

+26-15
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,46 @@ on:
55
inputs:
66
version:
77
description: 'Version'
8-
default: 'minor x.1.0'
8+
default: 'minor'
99
type: choice
1010
options:
11-
- patch x.x.1
12-
- minor x.1.0
13-
- major 1.0.0
11+
- patch
12+
- minor
13+
- major
1414

1515
jobs:
1616
release:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@master
2020

21-
- name: Install Dependencies
22-
run: |
21+
- name: Install Dependencies # vsce etc
22+
run: | # shell
2323
npm i
24-
npm i @vscode/vsce -g
2524
26-
- name: Build Extension
27-
run: npm run build
25+
- name: Build Extension # build `extension.js` and `*.wasm` files
26+
run: | # shell
27+
npm run build
2828
29-
- name: Setup Github Actions
30-
run: |
29+
- name: Setup Github Actions # allow use of `git push`
30+
run: | # shell
3131
git config --global user.name "RedCMD"
3232
git config --global user.email "[email protected]"
3333
git add .
3434
git diff-index --quiet HEAD || git commit -m "Sync Github Actions"
3535
36-
- name: Publish Release
37-
run: |
38-
vsce publish ${{ github.event.inputs.version }} -p ${{ secrets.VSCE_PAT }}
39-
git push
36+
- name: Package Extension # `.vsix` file
37+
run: | # shell
38+
npx vsce package ${{ github.event.inputs.version }}
39+
git push --follow-tags
40+
echo "VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_ENV"
41+
42+
- name: Generate Release # create release page on github with `.vsix` file
43+
run: | # shell
44+
gh release create v$VERSION --generate-notes tmlanguage-syntax-highlighter-$VERSION.vsix
45+
env:
46+
GH_TOKEN: ${{ github.token }}
47+
48+
- name: Publish Release # upload to Extension Marketplace
49+
run: | # shell
50+
npx vsce publish -p ${{ secrets.VSCE_PAT }} --packagePath tmlanguage-syntax-highlighter-$VERSION.vsix

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"browser": "./out/web/extension.js",
4141
"scripts": {
4242
"build": "npm run compile && npm run compile-web && npm run generate-wasm",
43-
"version": "git rm -f --ignore-unmatch *.vsix && vsce package && git add -f --ignore-errors *.vsix",
4443
"package": "vsce package",
4544
"watch": "tsc -watch -p ./",
4645
"watch-web": "webpack --watch",

0 commit comments

Comments
 (0)