-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 2.33 KB
/
release.yaml
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
# Generated by Fowl setup, do not modify it manually. Run `fowl setup` to generate this file again
name: Release Workflow
on:
push:
branches:
- release/*
jobs:
release:
if: contains(github.event.head_commit.message, 'chore(release)')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: Extract version from commit message
id: extract_version
run: |
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oP '\d+\.\d+\.\d+(-beta\.\d+)?')
TARGET_VERSION="${VERSION%-beta*}"
RELEASE_BRANCH="release/${TARGET_VERSION}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Determine release type
id: determine_release_type
run: |
if [[ "${VERSION}" == *"-beta"* ]]; then
echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
else
echo "RELEASE_TYPE=stable" >> $GITHUB_ENV
- name: Configure GitHub CLI
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Create Sync PR for beta release
if: env.RELEASE_TYPE == 'beta'
run: |
PR_URL=$(gh pr create --title "Beta Release $VERSION" --body "Beta release $VERSION" --base $BASE_BRANCH --head $RELEASE_BRANCH --json url | jq -r .url)
gh pr merge $PR_URL --auto
- name: Create Sync PRs for stable release
if: env.RELEASE_TYPE == 'stable'
run: |
PR_URL=$(gh pr create --title "Release $VERSION" --body "Release $VERSION" --base master --head $RELEASE_BRANCH --json url | jq -r .url)
gh pr merge $PR_URL --auto
PR_URL=$(gh pr create --title "Release $VERSION" --body "Release $VERSION" --base master --head $RELEASE_BRANCH --json url | jq -r .url)
gh pr merge $PR_URL --auto
- name: Generate release note message
run: |
OUTPUT=$(tsx ./helpers/github-actions.ts)
echo "RELEASE_NOTE_MESSAGE=${OUTPUT}" >> $GITHUB_ENV
- name: Send Slack notification
run: |
OUTPUT=$(tsx ./helpers/github-actions.ts)
curl -X POST -H 'Content-type: application/json' --data '{"text": "'"${OUTPUT}"'"}' ${{ secrets.SLACK_WEBHOOK_URL }}