Release #700
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 | |
concurrency: | |
group: ${{ github.workflow }} | |
on: | |
schedule: | |
- cron: '0 4 * * *' | |
workflow_dispatch: | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# A custom token must be used, as GitHub doesn't trigger workflows | |
# for pushes made using the default token | |
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | |
- name: Set up environment | |
uses: ./.github/actions/prepare-environment | |
- id: check-release-required | |
name: Check if release required | |
run: | | |
VERSION_REGEX=^v[0-9]+\.[0-9]+\.[0-9]+$ | |
echo "continue=$(! [[ `git describe --match 'v[0-9]*' --exact-match` =~ $VERSION_REGEX ]] && echo 1)" >> "$GITHUB_OUTPUT" | |
- name: Configure Git user | |
if: steps.check-release-required.outputs.continue | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git config push.autoSetupRemote true | |
- id: prepare-release | |
name: Prepare release | |
if: steps.check-release-required.outputs.continue | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npm run release | |
- id: git-branch | |
if: steps.check-release-required.outputs.continue | |
name: Get Git branch | |
run: echo "git-branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Wait for tests to succeed | |
if: steps.check-release-required.outputs.continue | |
uses: lewagon/wait-on-check-action@ccfb013c15c8afb7bf2b7c028fb74dc5a068cccc | |
with: | |
ref: ${{ steps.git-branch.outputs.git-branch }} | |
running-workflow-name: ${{ github.workflow }} | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 30 | |
- name: Merge release branch | |
if: steps.check-release-required.outputs.continue | |
run: | | |
git switch main | |
git merge --ff-only ${{ steps.git-branch.outputs.git-branch }} | |
git push --follow-tags origin main | |
- id: publish-release | |
name: Publish the release | |
if: steps.check-release-required.outputs.continue | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npm run dist:build | |
npm run release -- --no-increment --no-git --npm.publish --npm.skipChecks --github.release | |
- name: Delete release branch | |
if: always() && steps.check-release-required.outputs.continue && steps.git-branch.outputs.git-branch | |
run: git push --delete origin ${{ steps.git-branch.outputs.git-branch }} | |
- name: Delete tag on failure | |
if: always() && steps.prepare-release.outcome == 'success' && steps.publish-release.outcome != 'success' | |
run: git push --delete origin refs/tags/`git describe --tags --exact-match` |