-
Notifications
You must be signed in to change notification settings - Fork 180
46 lines (44 loc) · 1.7 KB
/
publish.yml
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
name: Publish release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
publish:
name: Publish to VS Code Marketplace
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Read extension version
id: ext-version
run: |
content=`cat ./package.json | jq -r .version`
echo "::set-output name=content::$content"
- name: Ensure version matches with tag
if: ${{ github.ref != format('refs/tags/v{0}', steps.ext-version.outputs.content) }}
run: |
echo "Version mismatch!"
echo "Received ref: ${{ github.ref }}"
echo "Expected ref: refs/tags/v${{ steps.ext-version.outputs.content }}"
exit 1
- uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: vsce package
run: npx -- vsce package --out=${{ runner.temp }}/terraform-${{ steps.ext-version.outputs.content }}.vsix
- name: Upload vsix as artifact
uses: actions/upload-artifact@v2
with:
name: terraform-${{ steps.ext-version.outputs.content }}
path: ${{ runner.temp }}/terraform-${{ steps.ext-version.outputs.content }}.vsix
- name: Check latest published version
run: |
export EXTENSION_ID=`cat package.json | jq -r '.publisher + "." + .name'`
npx -- vsce show --json $EXTENSION_ID | jq '.versions[0]'
- name: vsce publish
run: npx -- vsce publish --no-git-tag-version --packagePath=${{ runner.temp }}/terraform-${{ steps.ext-version.outputs.content }}.vsix
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}