-
-
Notifications
You must be signed in to change notification settings - Fork 65
113 lines (96 loc) · 3.27 KB
/
main.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
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
name: Test, Build, and Publish
on: [push]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile
- name: ESLint & Prettier
run: |
yarn check:eslint
yarn check:prettier
- name: Test keybinding generator
run: |
yarn test-gen-keys
yarn gen-keys
git diff --quiet || (echo "You have to run 'yarn gen-keys' and commit the updated package.json" && exit -1)
- name: Test
run: xvfb-run -a yarn test
if: runner.os == 'Linux'
- name: Test
run: yarn test
if: runner.os != 'Linux'
# Ref: https://github.com/redhat-developer/vscode-yaml/blob/89c53763249932454b766d09e7aa9035da7fb5b8/.github/workflows/CI.yaml#L48-L61
- name: Build the vsix package on Linux
if: matrix.os == 'ubuntu-latest'
run: |
if [ $IS_RELEASE = true ]; then
VERSION=$(node -p "require('./package.json').version")
else
VERSION=${{ github.sha }}
fi
yarn run vsce package -o emacs-mcx-${VERSION}-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}.vsix
- name: Upload the vsix built on Linux
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' && ! startsWith(github.ref, 'refs/tags/v') }}
with:
path: emacs-mcx*.vsix
name: emacs-mcx
- name: Upload the vsix built on Linux (when pushed with a version tag)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v') }}
with:
path: emacs-mcx*.vsix
name: emacs-mcx
release:
if: ${{ success() && startsWith(github.ref, 'refs/tags/v') }}
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: emacs-mcx
- name: Create a new release
uses: softprops/action-gh-release@v1
with:
files: emacs-mcx*.vsix
publish:
if: ${{ success() && startsWith(github.ref, 'refs/tags/v') }}
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [marketplace, openvsx]
steps:
- uses: actions/download-artifact@v3
with:
name: emacs-mcx
- run: |
files=( emacs-mcx*.vsix )
echo "vsix_filename=${files[0]}" >> $GITHUB_ENV
- if: matrix.target == 'marketplace'
name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
extensionFile: "${{ env.vsix_filename }}"
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
- if: matrix.target == 'openvsx'
name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
with:
extensionFile: "${{ env.vsix_filename }}"
pat: ${{ secrets.OPEN_VSX_TOKEN }}