-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (98 loc) · 3.17 KB
/
deploy-dev.yml
File metadata and controls
119 lines (98 loc) · 3.17 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
name: Create Release
on:
pull_request_target:
types:
- closed
workflow_dispatch:
inputs:
workflow_dispatch_version_label:
description: "Version type"
required: true
type: choice
options:
- major
- minor
- patch
permissions:
contents: write
jobs:
get_version_label:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/get-version-label.yml
with:
workflow_dispatch_version_label: ${{ github.event.inputs.workflow_dispatch_version_label }}
build:
needs: [get_version_label]
if: needs.get_version_label.result == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v6
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Setup Git
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
- name: Get Version Label
id: get_version_label
run: echo "version_label=${{ needs.get_version_label.outputs.version_label }}" >> $GITHUB_OUTPUT
- name: NPM Version
run: npm version "${{ steps.get_version_label.outputs.version_label }}"
- name: Get Version
id: get_version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Install vsce
run: npm install -g @vscode/vsce
- name: Package extension
run: vsce package --no-dependencies
- name: Push Version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin main --follow-tags
- name: Create GitHub release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
name: Release v${{ steps.get_version.outputs.version }}
body: |
Version ${{ steps.get_version.outputs.version }}
This release was automatically created from merged PR.
draft: false
prerelease: false
files: |
*.vsix
publish-vscode-marketplace:
needs: build
runs-on: ubuntu-latest
container: node:20-alpine
steps:
- name: Download extension artifact
uses: actions/download-artifact@v4
with:
name: extension-package
- name: Publish to VS Code Marketplace
run: npx @vscode/vsce publish --packagePath *.vsix -p ${{ secrets.VSCE_PUBLISH_TOKEN }}
publish-openvsx:
needs: build
runs-on: ubuntu-latest
container: node:20-alpine
steps:
- name: Download extension artifact
uses: actions/download-artifact@v4
with:
name: extension-package
- name: Publish to Open VSX
run: npx ovsx publish *.vsix -p ${{ secrets.OVSX_PUBLISH_TOKEN }}