⚠️ Create release #343
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: ⚠️ Create release | |
on: | |
workflow_dispatch: | |
inputs: | |
mode: | |
type: choice | |
description: release type | |
required: true | |
default: 'minor' | |
options: | |
- patch | |
- minor | |
- prerelease | |
- major | |
dryRun: | |
type: boolean | |
required: false | |
description: --dry-run | |
jobs: | |
run-release: | |
name: Run release | |
runs-on: ubuntu-latest | |
env: | |
IS_DRY_MODE: ${{ github.event.inputs.dryRun == 'true' }} | |
IS_RRE_RELEASE_MODE: ${{ contains(github.event.inputs.mode, 'prerelease') }} | |
steps: | |
- uses: taiga-family/ci/actions/setup/checkout@v1.66.2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} | |
- uses: taiga-family/ci/actions/setup/node@v1.66.2 | |
- uses: taiga-family/ci/actions/setup/config/git@v1.66.2 | |
with: | |
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} | |
- name: Run release | |
id: run-release | |
run: | | |
npx ts-node ./scripts/release.ts \ | |
--ci-mode \ | |
--release-as ${{ github.event.inputs.mode }} \ | |
--dry-run ${{ github.event.inputs.dryRun }} | |
echo "new_version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
- name: Generate Release Body | |
if: ${{ env.IS_RRE_RELEASE_MODE == 'false' }} | |
id: generate_body | |
run: | | |
npx extract-changelog-release > RELEASE_BODY.md | |
echo "tag_name=$(git describe --abbrev=0 --tags)" >> $GITHUB_OUTPUT | |
- id: get-pr-body | |
if: ${{ env.IS_RRE_RELEASE_MODE == 'false' }} | |
run: | | |
body=$(cat RELEASE_BODY.md) | |
delimiter="$(openssl rand -hex 8)" | |
echo "body<<$delimiter" >> $GITHUB_OUTPUT | |
echo "$body" >> $GITHUB_OUTPUT | |
echo "$delimiter" >> $GITHUB_OUTPUT | |
- name: Debug body of pull request in dry mode | |
if: ${{ env.IS_DRY_MODE == 'true' }} | |
run: echo "${{ steps.get-pr-body.outputs.body }}" | |
- name: Debug variables | |
if: ${{ env.IS_DRY_MODE == 'true' }} | |
run: | | |
echo "${{ steps.generate_body.outputs.tag_name }}" | |
echo "release/${{ steps.run-release.outputs.new_version }}" | |
echo "${{ steps.get-pr-body.outputs.body }}" | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
if: ${{ env.IS_DRY_MODE == 'false' }} | |
with: | |
delete-branch: true | |
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }} | |
branch: release/${{ steps.run-release.outputs.new_version }} | |
title: '🚀 Release/v${{ steps.run-release.outputs.new_version }}' | |
body: | | |
${{ steps.get-pr-body.outputs.body }} | |
- name: Create GitHub Release | |
if: ${{ env.IS_DRY_MODE == 'false' && env.IS_RRE_RELEASE_MODE == 'false' }} | |
uses: ncipollo/release-action@v1.14.0 | |
with: | |
name: Release ${{ steps.generate_body.outputs.tag_name }} | |
tag: ${{ steps.generate_body.outputs.tag_name }} | |
commit: ${{ github.head_ref || github.ref_name }} | |
bodyFile: 'RELEASE_BODY.md' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push release candidate tag | |
if: ${{ env.IS_RRE_RELEASE_MODE == 'true' }} | |
run: git push origin tag v${{ steps.run-release.outputs.new_version }} || echo "" | |
concurrency: | |
group: create-release-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true |