Skip to content

Commit 061a970

Browse files
committed
chore(ci): modernize GitHub Actions workflows to Node 20 and v4 actions
1 parent 0087882 commit 061a970

File tree

3 files changed

+84
-71
lines changed

3 files changed

+84
-71
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: main
22
on: [push, pull_request]
3-
env:
4-
SCRIPT_DIR: ./.github/scripts
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
57

68
jobs:
79
test:
@@ -10,10 +12,11 @@ jobs:
1012
os: [macos-latest, ubuntu-latest, windows-latest]
1113
runs-on: ${{ matrix.os }}
1214
steps:
13-
- uses: actions/checkout@v3
14-
- uses: actions/setup-node@v3
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
1517
with:
16-
node-version: 18
18+
node-version: 20
19+
cache: 'npm'
1720
- run: npm install
1821
- name: Run tests
1922
uses: GabrielBB/xvfb-action@v1.0
@@ -24,28 +27,32 @@ jobs:
2427
env:
2528
VSIX_FILE: vscode-R.vsix
2629
steps:
27-
- uses: actions/checkout@v3
28-
- run: npm install
29-
- uses: lannonbr/vsce-action@4.0.0
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-node@v4
3032
with:
31-
args: "package -o $VSIX_FILE"
33+
node-version: 20
34+
cache: 'npm'
35+
- run: npm install
36+
- name: Package extension
37+
run: npx @vscode/vsce package -o $VSIX_FILE
3238
- uses: actions/upload-artifact@v4
3339
with:
3440
name: ${{ env.VSIX_FILE }}
3541
path: ${{ env.VSIX_FILE }}
3642
eslint:
3743
runs-on: ubuntu-latest
3844
steps:
39-
- uses: actions/checkout@v3
40-
- uses: actions/setup-node@v3
45+
- uses: actions/checkout@v4
46+
- uses: actions/setup-node@v4
4147
with:
42-
node-version: 18
48+
node-version: 20
49+
cache: 'npm'
4350
- run: npm install
4451
- run: npm run lint
4552
markdownlint-cli:
4653
runs-on: ubuntu-latest
4754
steps:
48-
- uses: actions/checkout@v3
55+
- uses: actions/checkout@v4
4956
- uses: nosborn/github-action-markdown-cli@v1.1.1
5057
with:
5158
files: .

.github/workflows/pre-release.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,47 @@ on:
88

99
env:
1010
FILE_OUT: r-latest.vsix
11-
SCRIPT_DIR: ./.github/scripts
11+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
1213

1314
jobs:
1415
build:
1516
runs-on: ubuntu-latest
1617
steps:
17-
- uses: actions/checkout@v3
18-
- run: npm install
19-
- uses: lannonbr/vsce-action@4.0.0
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
2020
with:
21-
args: "package -o $FILE_OUT"
21+
node-version: 20
22+
cache: 'npm'
23+
- run: npm install
24+
- name: Package extension
25+
run: npx @vscode/vsce package -o $VSIX_FILE
2226
- uses: actions/upload-artifact@v4
2327
with:
24-
name: "${{ env.FILE_OUT }}"
25-
path: "${{ env.FILE_OUT }}"
28+
name: "${{ env.VSIX_FILE }}"
29+
path: "${{ env.VSIX_FILE }}"
2630

2731
pre-release:
2832
name: Pre-Release
2933
needs: build
3034
runs-on: ubuntu-latest
35+
permissions:
36+
contents: write
3137

3238
steps:
33-
- name: Update tag
34-
uses: richardsimko/update-tag@v1
35-
with:
36-
tag_name: latest
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
- uses: actions/checkout@v4
3940
- name: Download artifacts
40-
uses: actions/download-artifact@v4.1.7
41+
uses: actions/download-artifact@v4
4142
with:
43+
pattern: "${{ env.VSIX_FILE }}"
4244
path: "artifacts/"
43-
- name: Upload artifacts
44-
uses: meeDamian/github-release@2.0
45-
with:
46-
token: ${{ secrets.GITHUB_TOKEN }}
47-
tag: latest
48-
commitish: master
49-
name: Development Build
50-
body: Contains the vsix-file from the latest push to master.
51-
prerelease: true
52-
files: "artifacts/*/*"
53-
gzip: false
54-
allow_override: true
45+
- name: Create or update pre-release
46+
run: |
47+
gh release delete latest --yes || true
48+
git tag -d latest || true
49+
git tag latest
50+
git push origin latest --force
51+
gh release create latest artifacts/${{ env.VSIX_FILE }}/${{ env.VSIX_FILE }} \
52+
--title "Development Build" \
53+
--notes "Contains the vsix-file from the latest push to master." \
54+
--prerelease

.github/workflows/release.yml

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,68 @@ on:
88
tags: ["v*"]
99

1010
env:
11-
SCRIPT_DIR: ./.github/scripts
11+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1212

1313
jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3
18-
- run: npm install
19-
- uses: lannonbr/vsce-action@4.0.0
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-node@v4
2019
with:
21-
args: "package"
22-
- name: Identify output file # can be retrieved as steps.filenames.outputs.file_out
23-
id: filenames
24-
run: echo "::set-output name=file_out::$(ls | grep "^.*\.vsix$" | head -1)"
20+
node-version: 20
21+
cache: 'npm'
22+
- run: npm install
23+
- name: Package extension
24+
id: package
25+
run: |
26+
npx @vscode/vsce package
27+
echo "VSIX_FILE=$(ls *.vsix)" >> $GITHUB_OUTPUT
2528
- uses: actions/upload-artifact@v4
2629
with:
27-
name: ${{ steps.filenames.outputs.file_out }}
28-
path: ${{ steps.filenames.outputs.file_out }}
30+
name: vsix-artifact
31+
path: "*.vsix"
2932

3033
release:
3134
name: Release
3235
needs: build
3336
runs-on: ubuntu-latest
37+
permissions:
38+
contents: write
3439

3540
steps:
41+
- uses: actions/checkout@v4
3642
- name: Download artifacts
37-
uses: actions/download-artifact@v4.1.7
43+
uses: actions/download-artifact@v4
3844
with:
39-
path: "artifacts/"
40-
- name: Get version from tag
41-
id: get_version
42-
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\/v/}
45+
name: vsix-artifact
46+
path: artifacts/
4347
- name: Create release
44-
uses: marvinpinto/action-automatic-releases@latest
45-
with:
46-
repo_token: ${{ secrets.GITHUB_TOKEN }}
47-
files: "artifacts/*/*"
48-
prerelease: false
49-
draft: false
50-
48+
run: |
49+
VERSION=${GITHUB_REF#refs/tags/v}
50+
gh release create v$VERSION artifacts/*.vsix \
51+
--title "v$VERSION" \
52+
--notes "Release v$VERSION" \
53+
--generate-notes
5154
5255
publish:
5356
name: Publish
5457
timeout-minutes: 30
5558
runs-on: ubuntu-latest
59+
needs: build
5660
steps:
57-
- uses: actions/checkout@v3
61+
- uses: actions/checkout@v4
62+
- uses: actions/setup-node@v4
63+
with:
64+
node-version: 20
65+
cache: 'npm'
5866
- run: npm install
59-
- name: Publish to Open VSX Registry
60-
uses: HaaLeo/publish-vscode-extension@v1
61-
id: publishToOpenVSX
67+
- name: Download artifacts
68+
uses: actions/download-artifact@v4
6269
with:
63-
pat: ${{ secrets.OPEN_VSX_TOKEN }}
70+
name: vsix-artifact
71+
path: artifacts/
6472
- name: Publish to Visual Studio Marketplace
65-
uses: HaaLeo/publish-vscode-extension@v1
66-
with:
67-
pat: ${{ secrets.VSCE_TOKEN }}
68-
registryUrl: https://marketplace.visualstudio.com
69-
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
73+
run: npx @vscode/vsce publish -p ${{ secrets.VSCE_TOKEN }} --packagePath artifacts/*.vsix
74+
- name: Publish to Open VSX Registry
75+
run: npx ovsx publish -p ${{ secrets.OPEN_VSX_TOKEN }} --packagePath artifacts/*.vsix

0 commit comments

Comments
 (0)