Skip to content

Commit 106c4c8

Browse files
authored
Merge pull request #59 from OpenForgeProject/update-release
Update release
2 parents 35f692a + 8e41a56 commit 106c4c8

File tree

1 file changed

+58
-53
lines changed

1 file changed

+58
-53
lines changed

.github/workflows/release.yml

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
6+
- v*.*.*
7+
workflow_dispatch:
78

89
permissions:
910
contents: write
@@ -13,65 +14,69 @@ jobs:
1314
runs-on: ubuntu-latest
1415

1516
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v5
17+
- name: Checkout
18+
uses: actions/checkout@v6
1819

19-
- name: Setup Node.js
20-
uses: actions/setup-node@v5
21-
with:
22-
node-version: 'lts/*'
23-
cache: 'npm'
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v6
22+
with:
23+
node-version: lts/*
24+
cache: npm
2425

25-
- name: Install dependencies
26-
run: npm ci
26+
- name: Install dependencies
27+
run: npm ci
2728

28-
- name: Run tests
29-
uses: coactions/setup-xvfb@v1
30-
with:
31-
run: npm test
29+
- name: Lint code
30+
run: npm run lint
3231

33-
- name: Package extension
34-
run: |
35-
npx @vscode/vsce package
32+
- name: Run tests
33+
uses: coactions/setup-xvfb@v1
34+
with:
35+
run: npm test
3636

37-
- name: Get version from tag
38-
id: get_version
39-
run: |
40-
VERSION=${GITHUB_REF#refs/tags/v}
41-
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
42-
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
37+
- name: Package extension
38+
run: |
39+
npx @vscode/vsce package
4340
44-
- name: Extract changelog for version
45-
id: changelog
46-
run: |
47-
VERSION=${GITHUB_REF#refs/tags/v}
48-
# Extract changelog section for this version
49-
sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md
50-
if [ ! -s release_notes.md ]; then
51-
echo "No changelog found for version $VERSION"
52-
echo "# Release $VERSION" > release_notes.md
53-
echo "See CHANGELOG.md for details." >> release_notes.md
54-
fi
41+
- name: Upload Artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: vsix-package
45+
path: '*.vsix'
5546

56-
- name: Create GitHub Release
57-
uses: ncipollo/release-action@v1
58-
with:
59-
artifacts: '*.vsix'
60-
bodyFile: 'release_notes.md'
61-
draft: false
62-
prerelease: false
63-
name: 'Release ${{ steps.get_version.outputs.TAG }}'
64-
tag: ${{ steps.get_version.outputs.TAG }}
65-
token: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Get version from tag
48+
id: get_version
49+
if: startsWith(github.ref, 'refs/tags/')
50+
run: |
51+
VERSION=${GITHUB_REF#refs/tags/v}
52+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
53+
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
6654
67-
# Publishing to marketplaces requires secrets to be configured
68-
# VSCE_PAT and OVSX_PAT need to be added as repository secrets
69-
# Uncomment and configure these steps when ready to publish
55+
- name: Extract changelog for version
56+
id: changelog
57+
if: startsWith(github.ref, 'refs/tags/')
58+
run: |
59+
VERSION=${GITHUB_REF#refs/tags/v}
60+
# Extract changelog section for this version
61+
sed -n "/## \[$VERSION\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md
62+
if [ ! -s release_notes.md ]; then
63+
echo "No changelog found for version $VERSION"
64+
echo "# Release $VERSION" > release_notes.md
65+
echo "See CHANGELOG.md for details." >> release_notes.md
66+
fi
7067
71-
# - name: Publish to VS Code Marketplace
72-
# run: npx @vscode/vsce publish --pat ${{ secrets.VSCE_PAT }}
73-
# if: secrets.VSCE_PAT != null
68+
- name: Create GitHub Release
69+
uses: ncipollo/release-action@v1
70+
if: startsWith(github.ref, 'refs/tags/')
71+
with:
72+
artifacts: '*.vsix'
73+
bodyFile: release_notes.md
74+
draft: false
75+
prerelease: false
76+
name: 'Release ${{ steps.get_version.outputs.TAG }}'
77+
tag: ${{ steps.get_version.outputs.TAG }}
78+
token: ${{ secrets.GITHUB_TOKEN }}
7479

75-
# - name: Publish to Open VSX Registry
76-
# run: npx ovsx publish *.vsix --pat ${{ secrets.OVSX_PAT }}
77-
# if: secrets.OVSX_PAT != null
80+
- name: Publish to VS Code Marketplace
81+
if: startsWith(github.ref, 'refs/tags/')
82+
run: npx @vscode/vsce publish --packagePath *.vsix -p ${{ secrets.VSCE_PAT }}

0 commit comments

Comments
 (0)