-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (62 loc) · 2.12 KB
/
publish.yml
File metadata and controls
71 lines (62 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Publish Extension
on:
workflow_dispatch:
inputs:
version:
description: Version
default: minor
type: choice
options:
- patch
- minor
- major
- keep
push:
branches:
- main
paths:
- '**.tmLanguage.json'
- '**.language-configuration.json'
- '**.ts'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Dependencies # vsce etc
run: | # shell
npm i
- name: Build Extension # build `extension.js` and `*.wasm` files
run: | # shell
npm run build
- name: Run Tests # check everything is working
run: | # shell
npm run test:grammar && npm run test:browser --- --headless
- name: Setup Github Actions # allow use of `git push`
run: | # shell
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff-index --quiet HEAD || git commit -m "Sync Github Actions" || exit 0
- name: Package Extension # `.vsix` file
run: | # shell
if [ "${{ github.event.inputs.version }}" = "keep" ]; then
npm run package
elif [ "${{ github.event.inputs.version }}" = "" ]; then
npm run package --- patch --pre-release
else
npm run package --- ${{ github.event.inputs.version }}
fi
git push --follow-tags
echo VERSION=$(node -p "require('./package.json').version") >> $GITHUB_ENV
- name: Generate Release # create release page on github with `.vsix` file
if: github.event.inputs.version
run: | # shell
gh release create v$VERSION --generate-notes tmlanguage-syntax-highlighter-$VERSION.vsix
env:
GH_TOKEN: ${{ github.token }}
- name: Publish Release # upload to Extension Marketplace
run: | # shell
npm run publish --- --packagePath tmlanguage-syntax-highlighter-$VERSION.vsix
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}