-
Notifications
You must be signed in to change notification settings - Fork 7
121 lines (109 loc) · 3.59 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
publishMS:
description: 'Publish to the VS Marketplace'
type: boolean
required: true
default: "true"
publishOVSX:
description: 'Publish to OpenVSX'
type: boolean
required: true
default: "true"
publishGH:
description: 'Publish to GitHub Releases'
type: boolean
required: true
default: "true"
jobs:
package:
name: Package
runs-on: ubuntu-latest
outputs:
packageName: ${{ steps.setup.outputs.packageName }}
tag: ${{ steps.setup-tag.outputs.tag }}
version: ${{ steps.setup-tag.outputs.version }}
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm i
- name: Setup package path
id: setup
run: echo "::set-output name=packageName::$(node -e "console.log(require('./package.json').name + '-' + require('./package.json').version + '.vsix')")"
- name: Package
run: |
npx vsce package --out ${{ steps.setup.outputs.packageName }}
- name: Upload package
uses: actions/upload-artifact@v3
with:
name: ${{ steps.setup.outputs.packageName }}
path: ./${{ steps.setup.outputs.packageName }}
if-no-files-found: error
- name: Setup tag
id: setup-tag
run: |
$version = (Get-Content ./package.json -Raw | ConvertFrom-Json).version
Write-Host "tag: release/$version"
Write-Host "::set-output name=tag::release/$version"
Write-Host "::set-output name=version::$version"
shell: pwsh
publishMS:
name: Publish to VS marketplace
runs-on: ubuntu-latest
needs: package
if: github.event.inputs.publishMS == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
- name: Publish to VS marketplace
run: npx vsce publish --packagePath ./${{ needs.package.outputs.packageName }} -p ${{ secrets.VSCE_PAT }}
publishOVSX:
name: Publish to OpenVSX
runs-on: ubuntu-latest
needs: package
if: github.event.inputs.publishOVSX == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
- name: Publish to OpenVSX
run: npx ovsx publish ./${{ needs.package.outputs.packageName }} -p ${{ secrets.OVSX_PAT }}
publishGH:
name: Publish to GitHub releases
runs-on: ubuntu-latest
needs: package
if: github.event.inputs.publishGH == 'true'
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.package.outputs.tag }}
release_name: v${{ needs.package.outputs.version }}
draft: false
prerelease: false
- name: Upload assets to a Release
uses: AButler/[email protected]
with:
files: ${{ needs.package.outputs.packageName }}
release-tag: ${{ needs.package.outputs.tag }}
repo-token: ${{ secrets.GITHUB_TOKEN }}