-
Notifications
You must be signed in to change notification settings - Fork 223
104 lines (101 loc) · 3.83 KB
/
release.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
name: release
on:
workflow_dispatch:
inputs:
publishPreRelease:
description: 'Publish a pre-release ?'
required: true
type: choice
options:
- 'true'
- 'false'
default: 'false'
publishToMarketPlace:
description: 'Publish to VS Code Marketplace ?'
required: true
type: choice
options:
- 'true'
- 'false'
default: 'true'
publishToOVSX:
description: 'Publish to OpenVSX Registry ?'
required: true
type: choice
options:
- 'true'
- 'false'
default: 'true'
jobs:
packaging-job:
runs-on: ubuntu-latest
steps:
- name: Checkout vscode-yaml
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
path: release
node-version: 20
- name: Install dependencies
run: |
npm install -g typescript "yarn" "@vscode/vsce" "ovsx"
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
- name: Build vscode-yaml
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1
with:
run: |
yarn install
yarn run build
yarn run check-dependencies
- name: Run Unit Tests
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 #v1.0.1
with:
run: yarn test --silent
- name: Package
run: |
vsce package -o vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix
sha256sum *.vsix > vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix.sha256
ls -lash *.vsix *.sha256
- name: Upload VSIX Artifacts
uses: actions/upload-artifact@v4
with:
name: vscode-yaml
path: vscode-yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix
if-no-files-found: error
- name: Publish to GH Release Tab
if: ${{ inputs.publishToMarketPlace == 'true' && inputs.publishToOVSX == 'true' }}
uses: "marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.EXT_VERSION }}"
draft: true
files: |
vscode-yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.vsix
vscode-yaml-${{ env.EXT_VERSION }}-${{github.run_number}}*.sha256
release-job:
if: ${{ inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true' }}
environment: ${{ (inputs.publishToMarketPlace == 'true' || inputs.publishToOVSX == 'true') && 'release' || 'pre-release' }}
runs-on: ubuntu-latest
needs: packaging-job
steps:
- name: Checkout vscode-yaml
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: |
npm install -g typescript "yarn" "@vscode/vsce" "ovsx"
echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
- name: Download VSIX Artifacts
uses: actions/download-artifact@v4
- name: Publish to VS Code Marketplace
if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }}
run: |
vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix
- name: Publish to OpenVSX Registry
if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }}
run: |
ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-yaml/vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix