Skip to content

release v4.0.0-alpha.1 and include preset files #28

release v4.0.0-alpha.1 and include preset files

release v4.0.0-alpha.1 and include preset files #28

Workflow file for this run

name: Create GitHub Release
env:
NODE_VERSION: 22.14.0
PNPM_VERSION: 10.7.1
on:
push:
tags:
- v*
# Workflow need write access to the repository to create a release
permissions:
contents: write
# Make sure that only one release workflow runs at a time
concurrency:
group: release
jobs:
release:
name: Create GitHub release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up variables
uses: actions/github-script@v7
with:
script: |
const tag = process.env.GITHUB_REF.replace('refs/tags/', '');
// skip 'v' prefix, e.g. 'v1.2.3' -> '1.2.3'
const version = tag.slice(1);
const changelogUrl = `https://github.com/AdguardTeam/AGLint/blob/master/CHANGELOG.md`;
const releaseBody = [
`We are happy to announce the release of ${tag}!`,
'',
`Please see the [CHANGELOG](${changelogUrl}) for more information.`,
].join('\n');
// Regular expression from semver.org
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
// Note: capturing group 4 stands for the prerelease version
const match = SEMVER_REGEX.exec(version);
const isPreRelease = match && match[4] !== undefined;
core.exportVariable('TAG_NAME', tag);
core.exportVariable('RELEASE_BODY', releaseBody);
core.exportVariable('IS_PRERELEASE', isPreRelease.toString());
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ env.TAG_NAME }}
tag_name: ${{ env.TAG_NAME }}
body: ${{ env.RELEASE_BODY }}
draft: false
prerelease: ${{ env.IS_PRERELEASE == 'true' }}
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/AGLint' &&
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 }}