prepare v2.0.0 prerelease #21
Workflow file for this run
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: Create GitHub Release | |
| env: | |
| NODE_VERSION: 22 | |
| PNPM_VERSION: 10.7.1 | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| # Workflow need write access to the repository to create a release | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: List files | |
| run: ls -alt | |
| - name: Run markdownlint | |
| run: pnpm lint:md | |
| - name: Run ESLint | |
| run: pnpm lint:ts | |
| # Convert grammar to PList format & Test compile & Run ESBuild & Generate VSIX file | |
| - name: Create production build | |
| run: pnpm build:prod | |
| - name: Create build.txt with version | |
| run: pnpm build:txt | |
| - name: Extract changelog | |
| run: | | |
| # Import version from package.json using pnpm | |
| export VERSION=$(pnpm pkg get version | tr -d '"') | |
| pnpm extract-changelog -e $VERSION | |
| - name: Set up variables | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const tag = context.ref.replace('refs/tags/', ''); | |
| const refRes = await github.rest.git.getRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: `tags/${tag}`, | |
| }); | |
| const { object } = refRes.data; | |
| let tagMessage = ''; | |
| if (object.type === 'tag') { | |
| // Annotated tag | |
| const tagObj = await github.rest.git.getTag({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag_sha: object.sha, | |
| }); | |
| tagMessage = (tagObj.data.message || '').trim(); | |
| } else { | |
| // Lightweight tag | |
| tagMessage = ''; | |
| } | |
| const isPreRelease = tagMessage.toLowerCase() === 'prerelease'; | |
| core.exportVariable('TAG_NAME', tag); | |
| core.exportVariable('IS_PRERELEASE', isPreRelease.toString()); | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| syntaxes/out/adblock.plist | |
| out/vscode-adblock.vsix | |
| draft: false | |
| prerelease: ${{ env.IS_PRERELEASE }} | |
| body_path: ./out/TEMP_CHANGES.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| notify: | |
| name: Send Slack notification | |
| needs: release | |
| # Note: 'always()' is needed to run the notify job even if the test job was failed | |
| if: | |
| ${{ | |
| always() && | |
| github.repository == 'AdguardTeam/VscodeAdblockSyntax' && | |
| github.event_name == 'push' | |
| }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Slack notification | |
| uses: 8398a7/action-slack@v3 | |
| with: | |
| status: ${{ needs.release.result }} | |
| fields: workflow, repo, message, commit, author, eventName, ref, job | |
| job_name: release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |