Skip to content

Commit 48d81ba

Browse files
committed
chore: update GitHub Actions workflows for build and release processes
1 parent 9759492 commit 48d81ba

File tree

2 files changed

+109
-113
lines changed

2 files changed

+109
-113
lines changed

.github/workflows/build.yml

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,39 @@
1-
name: Build + Test
2-
3-
on: [push, pull_request]
4-
5-
jobs:
6-
test:
7-
runs-on: ${{ matrix.os }}
8-
strategy:
9-
matrix:
10-
os: [ubuntu-latest]
11-
node-version: [16.x]
12-
13-
name: ${{ matrix.os }} (Node.js ${{ matrix.node-version }})
14-
15-
steps:
16-
- name: Checkout 🛎
17-
uses: actions/checkout@v2
18-
- name: Setup Node.js ${{ matrix.node-version }} ⚙
19-
uses: actions/setup-node@v2
20-
with:
21-
node-version: ${{ matrix.node-version }}
22-
- name: Run display server 🖥
23-
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
24-
shell: bash
25-
if: ${{ success() && matrix.os == 'ubuntu-latest' }}
26-
- name: Install node_modules 📦
27-
run: npm ci
28-
- name: Cache node_modules 💾
29-
uses: actions/cache@v2
30-
env:
31-
cache-name: cache-node-modules
32-
with:
33-
# npm cache files are stored in `~/.npm` on Linux/macOS
34-
path: ~/.npm
35-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
36-
restore-keys: |
37-
${{ runner.os }}-build-${{ env.cache-name }}-
38-
${{ runner.os }}-build-
39-
${{ runner.os }}-
40-
- name: Test + Build 🚀
41-
run: |
42-
npm test
43-
npm run vscode:prepublish
44-
env:
45-
DISPLAY: ':99.0'
1+
name: Build + Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-and-test:
7+
name: Build & Test Extension
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout 🛎
12+
uses: actions/checkout@v4
13+
14+
- name: Run display server 🖥
15+
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
16+
shell: bash
17+
18+
- name: Install node_modules 📦
19+
run: npm ci
20+
21+
- name: Cache node_modules 💾
22+
uses: actions/cache@v4
23+
env:
24+
cache-name: cache-node-modules
25+
with:
26+
# npm cache files are stored in `~/.npm` on Linux/macOS
27+
path: ~/.npm
28+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-build-${{ env.cache-name }}-
31+
${{ runner.os }}-build-
32+
${{ runner.os }}-
33+
34+
- name: Test + Build 🚀
35+
run: |
36+
npm test
37+
npm run vscode:prepublish
38+
env:
39+
DISPLAY: ':99.0'

.github/workflows/release.yml

Lines changed: 70 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,70 @@
1-
name: Release + Publish
2-
3-
on:
4-
workflow_dispatch:
5-
inputs:
6-
versionChange:
7-
type: choice
8-
description: Select the version change
9-
requried: true
10-
options:
11-
- major
12-
- minor
13-
- patch
14-
15-
jobs:
16-
release:
17-
runs-on: ubuntu-latest
18-
env:
19-
VERSION_CHANGE: ${{ github.event.inputs.versionChange }}
20-
steps:
21-
- name: Checkout 🛎️
22-
uses: actions/checkout@v2
23-
with:
24-
fetch-depth: 0
25-
- name: Setup Node.js ⚙️
26-
uses: actions/setup-node@v2
27-
with:
28-
node-version: 'lts/*'
29-
- name: Install node_modules 📦
30-
run: |
31-
npm ci
32-
npm install --global @vscode/vsce
33-
- name: Update version ↗
34-
run: |
35-
git config --global user.name 'Philipp Kief'
36-
git config --global user.email 'PKief@users.noreply.github.com'
37-
git config --global push.followTags true
38-
npm version ${{ env.VERSION_CHANGE }} -m "Release %s"
39-
- name: Get meta data 🔍
40-
run: |
41-
NODE_VERSION=$(node -p -e "require('./package.json').version")
42-
echo VERSION=$NODE_VERSION >> $GITHUB_ENV
43-
NODE_NAME=$(node -p -e "require('./package.json').name")
44-
echo NAME=$NODE_NAME >> $GITHUB_ENV
45-
NODE_DISPLAY_NAME=$(node -p -e "require('./package.json').displayName")
46-
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV
47-
- name: Build ⚒️
48-
run: vsce package
49-
- name: Push tags 📌
50-
run: git push
51-
- name: Release ${{ env.VERSION }} 🔆
52-
uses: softprops/action-gh-release@v1
53-
with:
54-
files: ${{ env.NAME }}-${{ env.VERSION }}.vsix
55-
tag_name: v${{ env.VERSION }}
56-
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }}
57-
generate_release_notes: true
58-
- name: Publish to Open VSX Registry 🌐
59-
uses: HaaLeo/publish-vscode-extension@v1
60-
with:
61-
pat: ${{ secrets.OPEN_VSX_TOKEN }}
62-
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix
63-
- name: Publish to Visual Studio Marketplace 🌐
64-
uses: HaaLeo/publish-vscode-extension@v1
65-
with:
66-
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
67-
registryUrl: https://marketplace.visualstudio.com
68-
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix
1+
name: Release + Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionChange:
7+
type: choice
8+
description: Select the version change
9+
required: true
10+
options:
11+
- major
12+
- minor
13+
- patch
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
env:
19+
VERSION_CHANGE: ${{ github.event.inputs.versionChange }}
20+
steps:
21+
- name: Checkout 🛎️
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Install node_modules 📦
27+
run: |
28+
npm ci
29+
npm install --global @vscode/vsce
30+
31+
- name: Update version ↗
32+
run: |
33+
git config --global user.name 'Philipp Kief'
34+
git config --global user.email 'PKief@users.noreply.github.com'
35+
git config --global push.followTags true
36+
npm version ${{ env.VERSION_CHANGE }} -m "Release %s"
37+
38+
- name: Get meta data 🔍
39+
run: |
40+
NODE_VERSION=$(node -p -e "require('./package.json').version")
41+
echo VERSION=$NODE_VERSION >> $GITHUB_ENV
42+
NODE_NAME=$(node -p -e "require('./package.json').name")
43+
echo NAME=$NODE_NAME >> $GITHUB_ENV
44+
NODE_DISPLAY_NAME=$(node -p -e "require('./package.json').displayName")
45+
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV
46+
47+
- name: Build ⚒️
48+
run: vsce package
49+
50+
- name: Push tags 📌
51+
run: git push
52+
53+
- name: Release ${{ env.VERSION }} 🔆
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
files: ${{ env.NAME }}-${{ env.VERSION }}.vsix
57+
tag_name: v${{ env.VERSION }}
58+
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }}
59+
generate_release_notes: true
60+
- name: Publish to Open VSX Registry 🌐
61+
uses: HaaLeo/publish-vscode-extension@v2
62+
with:
63+
pat: ${{ secrets.OPEN_VSX_TOKEN }}
64+
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix
65+
- name: Publish to Visual Studio Marketplace 🌐
66+
uses: HaaLeo/publish-vscode-extension@v2
67+
with:
68+
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
69+
registryUrl: https://marketplace.visualstudio.com
70+
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix

0 commit comments

Comments
 (0)