-
Notifications
You must be signed in to change notification settings - Fork 79
130 lines (109 loc) · 4.19 KB
/
main.yml
File metadata and controls
130 lines (109 loc) · 4.19 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Yarn
uses: actions/setup-node@v6
with:
cache: yarn
- name: Install dependencies
run: yarn --prefer-offline
- name: Check formatting and lints
run: yarn run check
- name: Ensure auto-generated files are up-to-date
run: yarn run ts-node ./meta.ts --ensure-up-to-date --check
- name: Check tests
run: xvfb-run -a yarn run test
env:
MOCHA_REPORTER: dot
publish:
needs: check
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
extension:
- path: .
tag_prefix: v
marketplace_id: gregoire.dance
pre_release_vsix: dance
- path: extensions/helix
tag_prefix: helix/v
marketplace_id: gregoire.dance-helix
pre_release_vsix: extensions/helix/dance-helix
steps:
- uses: actions/checkout@v5
- name: Create tag based on package.json
uses: butlerlogic/action-autotag@ade8d2e19bfcd1e6a91272e2849b4bf4c37a67f1
id: autotag
with:
tag_prefix: ${{ matrix.extension.tag_prefix }}
package_root: ${{ matrix.extension.path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Yarn
uses: actions/setup-node@v6
with:
cache: yarn
- name: Install dependencies
run: yarn --prefer-offline
working-directory: ${{ matrix.extension.path }}
- name: Compute pre-release versions
id: pre-release-versions
working-directory: ${{ matrix.extension.path }}
shell: bash
run: |
echo MARKETPLACE=$(yarn run --silent vsce show ${{ matrix.extension.marketplace_id }} --json | jq '.versions[0].version' --raw-output) >> "$GITHUB_OUTPUT"
echo LOCAL=$(cat package.json | jq '.scripts["package:pre"]' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') >> "$GITHUB_OUTPUT"
- name: Compute needed changes
id: needs
shell: bash
run: |
echo release=${{ steps.autotag.outputs.tagcreated == 'yes' }} >> "$GITHUB_OUTPUT"
echo prerelease=${{ steps.pre-release-versions.outputs.MARKETPLACE != steps.pre-release-versions.outputs.LOCAL }} >> "$GITHUB_OUTPUT"
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@65512ae7dcf96159b51fdd7ed73eb17d5cacad33
if: ${{ steps.needs.outputs.release }}
id: publishToOpenVSX
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
packagePath: ${{ matrix.extension.path }}
yarn: true
skipDuplicate: true
dependencies: false
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@65512ae7dcf96159b51fdd7ed73eb17d5cacad33
if: ${{ steps.needs.outputs.release }}
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
packagePath: '' # Default is `./` and conflicts with `extensionFile`.
yarn: true
skipDuplicate: true
dependencies: false
- name: Build pre-release .vsix
if: ${{ steps.needs.outputs.prerelease }}
working-directory: ${{ matrix.extension.path }}
run: yarn run package:pre
- name: Publish pre-release to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@65512ae7dcf96159b51fdd7ed73eb17d5cacad33
if: ${{ steps.needs.outputs.prerelease }}
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ matrix.extension.pre_release_vsix }}-${{ steps.pre-release-versions.outputs.LOCAL }}.vsix
packagePath: '' # Default is `./` and conflicts with `extensionFile`.
yarn: true
preRelease: true
skipDuplicate: true
dependencies: false