-
Notifications
You must be signed in to change notification settings - Fork 20
140 lines (121 loc) · 4.68 KB
/
ci.yaml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: CI
on: [push, pull_request]
env:
PACKAGE_NAME: ide-vscode
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Prepare: Checkout Repository"
uses: actions/checkout@v2
- name: "Prepare: Use Node.js ${{ matrix.node-version }}"
uses: actions/setup-node@v4
with:
node-version: v22.x
#- name: "Prepare: Setup sonarqube"
# uses: warchant/setup-sonar-scanner@v1
- run: npm install
- run: npm run lint
- run: npm run vscode:prepublish
#- run: npm test
# env:
# CI: true
- name: "Prepare: Package VSCode Extension"
uses: actions/setup-node@v4
with:
node-version: v22.x
- run: npm install -g @vscode/[email protected]
- run: vsce package --out dist/
#- name: "Run sonar-scanner"
# env:
# to get access to secrets.SONAR_TOKEN, provide GITHUB_TOKEN
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: sonar-scanner
# -Dsonar.login=${{ secrets.SONAR_TOKEN }}
- name: "Upload Artifact: VSIX Packages"
uses: actions/upload-artifact@v4
with:
name: package
path: dist/*.vsix
release-github:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: "Prepare: Checkout Repository"
uses: actions/checkout@v2
- name: "Prepare: Get Build Artifact"
uses: actions/download-artifact@v2
with:
name: package
path: dist/
- name: "Prepare: Get the version"
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: "Prepare: Get changelog for current version"
id: get_changelog
run: |
CHANGELOG=$(ed --silent CHANGELOG.md <<< "/## ${VERSION}/+;/## /-p")
# Escape Newlines for set-output, see:
# https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/m-p/38372#M3322
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "::set-output name=CHANGELOG::$CHANGELOG"
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: "Check for valid release package"
run: test -e ./dist/${PACKAGE_NAME}-${{ steps.get_version.outputs.VERSION }}.vsix
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: ${{ steps.get_changelog.outputs.CHANGELOG }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ env.PACKAGE_NAME }}-${{ steps.get_version.outputs.VERSION }}.vsix
asset_name: ${{ env.PACKAGE_NAME }}-${{ steps.get_version.outputs.VERSION }}.vsix
asset_content_type: application/zip
release-marketplace:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: "Prepare: Checkout Repository"
uses: actions/checkout@v2
- name: "Prepare: Use Node.js ${{ matrix.node-version }}"
uses: actions/setup-node@v1
with:
node-version: v12.x
- name: "Prepare: Get Build Artifact"
uses: actions/download-artifact@v2
with:
name: package
path: dist/
- name: "Prepare: Get the version"
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- run: npm install -g @vscode/[email protected]
- run: vsce publish -p "${MARKETPLACE_TOKEN}" --packagePath dist/${PACKAGE_NAME}-${VERSION}.vsix
env:
# Note: Marketplace Token according to:
# https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token
# The token is only valid for a limited time - renewal might be required.
MARKETPLACE_TOKEN: ${{ secrets.MARKETPLACE_TOKEN }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
- run: npm install -g [email protected]
- run: ovsx publish -p "${OPENVSX_NAMESPACE_TOKEN}" --packagePath dist/${PACKAGE_NAME}-${VERSION}.vsix
env:
OPENVSX_NAMESPACE_TOKEN: ${{ secrets.OPENVSX_NAMESPACE_TOKEN }}
VERSION: ${{ steps.get_version.outputs.VERSION }}