-
Notifications
You must be signed in to change notification settings - Fork 463
87 lines (76 loc) · 2.97 KB
/
create-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: ⚠️ Create release
on:
workflow_dispatch:
inputs:
mode:
type: choice
description: release type
required: true
default: 'minor'
options:
- patch
- minor
- prerelease
- major
jobs:
run-release:
name: Run release
runs-on: ubuntu-latest
env:
IS_RRE_RELEASE_MODE: ${{ contains(github.event.inputs.mode, 'prerelease') }}
steps:
- uses: taiga-family/ci/actions/setup/[email protected]
with:
fetch-depth: 0
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/config/[email protected]
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 }}
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: Create Pull Request
uses: peter-evans/create-pull-request@v7
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 }}
---
> **DO NOT SQUASH OR REBASE ME**
> if user merges this PR via rebasing or using squash, it will cause lost of the tag. It happens because tag is already
> attached to the initial release commit SHA. If we use rebase or squash, the commit sha changes and already created tag
> points to not-existing commit.
- name: Create GitHub Release
if: ${{ env.IS_RRE_RELEASE_MODE == 'false' }}
uses: ncipollo/[email protected]
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 tag
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