-
-
Notifications
You must be signed in to change notification settings - Fork 460
118 lines (116 loc) · 3.95 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
114
115
116
117
118
name: "Main"
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
name: Test on ${{ matrix.os }}
steps:
- uses: pnpm/action-setup@v2
with:
version: 7
run_install: false
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
if: runner.os != 'Windows'
with:
node-version-file: ".nvmrc"
- uses: actions/setup-node@v3
if: runner.os == 'Windows'
with:
node-version: 14
- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
shell: bash
if: ${{ success() && matrix.os == 'ubuntu-latest' }}
- run: yarn install
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn test
env:
DISPLAY: ":99.0"
package:
runs-on: ubuntu-latest
needs: test
name: Package
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
if: runner.os != 'Windows'
with:
node-version-file: ".nvmrc"
- uses: actions/setup-node@v3
if: runner.os == 'Windows'
with:
node-version: 14
- run: yarn install
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm install -g vsce
- run: vsce package
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
with:
path: ${{ env.VSIX_PATH }}
name: ${{ env.VSIX_NAME }}
release:
runs-on: ubuntu-latest
needs: package
if: startsWith(github.ref, 'refs/tags/v')
name: Release
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
if: runner.os != 'Windows'
with:
node-version-file: ".nvmrc"
- uses: actions/setup-node@v3
if: runner.os == 'Windows'
with:
node-version: 14
- run: yarn install
- run: npm install -g vsce
- run: vsce package
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: See [CHANGE LOG](https://github.com/prettier/prettier-vscode/blob/main/CHANGELOG.md) for details.
draft: false
prerelease: false
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.VSIX_PATH }}
asset_name: ${{ env.VSIX_NAME }}
asset_content_type: application/zip
- run: vsce publish -p ${{ secrets.MARKETPLACE_TOKEN }}