Added github releases workflow #1
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - "package.json" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| - name: Get version from package.json | |
| id: get_version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if tag exists | |
| id: check_tag | |
| run: | | |
| TAG="v${{ steps.get_version.outputs.version }}" | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "Tag $TAG already exists. Skipping release." | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Tag $TAG does not exist. Creating release." | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Install dependencies | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: npm ci | |
| - name: Package Extension | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: npx vsce package | |
| - name: Create Release | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| files: "*.vsix" | |
| generate_release_notes: true |