updated GH workflow file #13
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 VSCode Extension | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Install Dependencies | |
run: npm install | |
- name: Install vsce | |
run: npm install -g vsce | |
# Read package.json and set variables | |
- name: Read package.json | |
run: | | |
extension_name=$(node -p "require('./package.json').name") | |
extension_version=$(node -p "require('./package.json').version") | |
echo "EXTENSION_NAME=$extension_name" >> $GITHUB_ENV | |
echo "EXTENSION_VERSION=$extension_version" >> $GITHUB_ENV | |
# fixme: run tests | |
# - name: Run Tests | |
# run: npm run test | |
- name: Package Extension | |
run: npx vsce package | |
# Rename the vsix file | |
- name: Rename VSIX | |
run: mv *.vsix ${{ env.EXTENSION_NAME }}.v${{ env.EXTENSION_VERSION }}.vsix | |
# Create GitHub Pre Release and Upload VSIX | |
- name: Create GitHub Pre Release and Upload VSIX | |
run: | | |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" | |
gh release create v${{ env.EXTENSION_VERSION }} ./${{ env.EXTENSION_NAME }}.v${{ env.EXTENSION_VERSION }}.vsix --prerelease -t "blits-vscode v${{ env.EXTENSION_VERSION }}" -n "Version ${{ env.EXTENSION_VERSION }} of ${{ env.EXTENSION_NAME }}" |