-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (53 loc) · 1.83 KB
/
create-PR-deploy-to-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
name: Create PR Deploy to Release
on:
push:
branches:
- deploy/*
pull_request:
branches:
- deploy/*
env:
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }}
permissions:
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set Env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}" >> $GITHUB_ENV
echo "VERSION=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\///' | cut -d'-' -f1)" >> $GITHUB_ENV
echo "NETWORK=$(echo -n ${{ env.HEAD_BRANCH }} | sed 's/.*deploy\/v[0-9\.]*-\(.*\)/\1/')" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: 'release/${{ env.VERSION }}'
fetch-depth: 0
fetch-tags: 'true'
- name: Get Testnet Latest Tag
if: ${{ env.NETWORK == 'testnet' }}
run: |
echo "LATESTTAG=$(git describe --tags --match "*testnet*" --abbrev=0)" >> $GITHUB_ENV
- name: Get Mainnet Latest Tag
if: ${{ env.NETWORK == 'mainnet' }}
run: |
echo "LATESTTAG=$(git describe --tags --match "*mainnet*" --abbrev=0)" >> $GITHUB_ENV
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
git reset --hard ${HEAD_BRANCH}
- name: Generate Release note
id: template
run: |
echo "VERSION=${{ env.VERSION }} - SHA: ${{ github.sha }}" > CHANGELOG.md
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 #v5.0.2
with:
labels: automated PR
delete-branch: true
title: 'chore(`release/${{ env.VERSION }}`): merge from `${{ env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{ env.PR_BRANCH }}