0.2.1 #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ^18 | |
- run: npm install | |
# - run: npm test | |
- run: npm install -g vsce | |
- name: Check version | |
run: | | |
npx -c 'echo VERSION=${npm_package_version}' >> $GITHUB_ENV | |
- name: Check if the version is prerelease or not | |
run: | | |
VERSION_MAJOR="${VERSION%%\.*}" | |
VERSION_MINOR="${VERSION#*.}" | |
VERSION_MINOR="${VERSION_MINOR%.*}" | |
VERSION_PATCH="${VERSION##*.}" | |
if [ $((VERSION_MINOR%2)) -eq 0 ]; then | |
echo PRERELEASE=false >> $GITHUB_ENV | |
else | |
echo PRERELEASE=true >> $GITHUB_ENV | |
fi | |
- run: vsce package | |
if: ${{ env.PRERELEASE == 'false' }} | |
- run: vsce package --pre-release | |
if: ${{ env.PRERELEASE == 'true' }} | |
- run: vsce publish -p ${{ secrets.VSCE_PAT }} | |
if: ${{ env.PRERELEASE == 'false' }} | |
- run: vsce publish -p ${{ secrets.VSCE_PAT }} --pre-release | |
if: ${{ env.PRERELEASE == 'true' }} |