Skip to content

Commit

Permalink
add support for prereleases
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuisi committed Oct 18, 2023
1 parent bc7033a commit 247d93a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ jobs:
npm ci
npx lerna bootstrap --ci
npm run build
npx lerna run --scope=lean4 package
- name: Package
run: npx lerna run --scope=lean4 package
if: ${{ !startsWith(github.ref, 'refs/tags/v') || !endsWith(github.ref, '-pre') }}

- name: Package pre-release
run: npx lerna run --scope=lean4 packagePreRelease
if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') }}

- name: Upload artifact
uses: actions/upload-artifact@v2
Expand All @@ -53,7 +60,7 @@ jobs:
path: 'vscode-lean4/lean4-*.vsix'

- name: Publish packaged extension
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest'
if: ${{ startsWith(github.ref, 'refs/tags/v') && !endsWith(github.ref, '-pre') && matrix.os == 'ubuntu-latest' }}
run: |
cd vscode-lean4
npx vsce publish -i lean4-*.vsix
Expand All @@ -62,6 +69,16 @@ jobs:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

- name: Publish packaged pre-release extension
if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && matrix.os == 'ubuntu-latest' }}
run: |
cd vscode-lean4
npx vsce publish --pre-release -i lean4-*.vsix
npx ovsx publish --pre-release lean4-*.vsix
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

- name: Upload extension as release
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest'
uses: softprops/action-gh-release@v1
Expand Down
13 changes: 13 additions & 0 deletions prerelease.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
if [ $# != 1 ]; then
echo Usage: ./prerelease.sh 1.2.3
exit 1
fi

new_version="$1"
sed -i 's/"version": ".*"/"version": "'$new_version'"/' vscode-lean4/package.json
git commit -am "Release $new_version (pre-release)"
git tag -a v$new_version-pre -m "vscode-lean4 $new_version (pre-release)"

git push
git push --tags
1 change: 1 addition & 0 deletions vscode-lean4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@
"watch": "webpack --env development --watch",
"watchTest": "concurrently \"tsc -p . -w --outDir out\" \"npm run watch\"",
"package": "vsce package",
"packagePreRelease": "vsce package --pre-release",
"pretest": "tsc -p . --outDir out",
"test": "node ./out/test/suite/runTest.js"
},
Expand Down

0 comments on commit 247d93a

Please sign in to comment.