Skip to content

Commit 0213680

Browse files
committed
Add pre-release actions
1 parent 0453ff9 commit 0213680

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

.github/workflows/pre_release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pre-release
2+
3+
on: workflow_dispatch
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
token: ${{ secrets.PRE_RELEASE_PAT }}
16+
- name: Increment version
17+
run: |
18+
git config user.name 'github-actions[bot]'
19+
git config user.email 'github-actions[bot]@users.noreply.github.com'
20+
npm version patch -m "Pre-release %s"
21+
git push --follow-tags

.github/workflows/release.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ jobs:
6262
debug-raspberry-pi-pico-*.vsix
6363
raspberry-pi-pico-*.vsix
6464
ovsx-raspberry-pi-pico-*.vsix
65+
66+
# Test PATs
6567
- name: Test PAT
6668
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
6769
env:
@@ -72,21 +74,38 @@ jobs:
7274
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
7375
run: |
7476
npx ovsx verify-pat -p ${{ secrets.OPEN_VSX_PAT }}
77+
78+
# Pre-release
79+
- name: Add Pre-release Notes
80+
uses: softprops/action-gh-release@v2
81+
if: startsWith(github.ref, 'refs/tags/') && contains(github.event.head_commit.message, 'Pre-release')
82+
with:
83+
prerelease: true
84+
generate_release_notes: true
85+
body: "> **Note: This is a pre-release, so may not be stable**"
86+
files: |
87+
debug-raspberry-pi-pico-*.vsix
88+
raspberry-pi-pico-*.vsix
89+
ovsx-raspberry-pi-pico-*.vsix
90+
91+
# Release
7592
- name: Add Release Asset
7693
uses: softprops/action-gh-release@v2
77-
if: startsWith(github.ref, 'refs/tags/')
94+
if: startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, 'Pre-release')
7895
with:
7996
files: |
8097
debug-raspberry-pi-pico-*.vsix
8198
raspberry-pi-pico-*.vsix
8299
ovsx-raspberry-pi-pico-*.vsix
100+
101+
# Publishing
83102
- name: Publish Extension
84103
if: startsWith(github.ref, 'refs/tags/')
85104
env:
86105
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_PAT }}
87106
run: |
88-
vsce publish -i raspberry-pi-pico-*.vsix
107+
vsce publish -i ${{ contains(github.event.head_commit.message, 'Pre-release') && 'debug-raspberry-pi-pico-*.vsix --pre-release' || 'raspberry-pi-pico-*.vsix' }}
89108
- name: Publish Extension to OVSX
90109
if: startsWith(github.ref, 'refs/tags/')
91110
run: |
92-
npx ovsx publish ovsx-raspberry-pi-pico-*.vsix -p ${{ secrets.OPEN_VSX_PAT }}
111+
npx ovsx publish ovsx-raspberry-pi-pico-*.vsix -p ${{ secrets.OPEN_VSX_PAT }} ${{ contains(github.event.head_commit.message, 'Pre-release') && '--pre-release' || '' }}

0 commit comments

Comments
 (0)