-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (54 loc) · 1.75 KB
/
reusable-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
on:
workflow_call:
inputs:
release_prefix:
required: true
type: string
release_branch:
required: false
default: main
type: string
develop_branch:
required: false
default: develop
type: string
sync_pr_label:
required: false
default: tools-bot
type: string
secrets:
USER_TOKEN:
required: true
jobs:
write-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.USER_TOKEN }}
- name: Create Release
uses: docker://antonyurchenko/git-release:v3.5.0
env:
GITHUB_TOKEN: ${{ secrets.USER_TOKEN }}
RELEASE_NAME_PREFIX: "${{ inputs.release_prefix }} "
ALLOW_TAG_PREFIX: true
- name: Attempt fast-forward develop from release
run: |
git fetch --prune
git checkout ${{ inputs.develop_branch }} && git pull --ff-only
git merge --ff-only origin/${{ inputs.release_branch }}
git push
- name: On failure, open PR to bring release back to develop
if: ${{ failure() }}
env:
PR_TITLE: Pulling ${{ github.ref }} into ${{ inputs.develop_branch }}
PR_BODY: Fast-forward of ${{ inputs.release_branch }} to ${{ inputs.develop_branch }} failed!
GH_TOKEN: ${{ secrets.USER_TOKEN }}
run: |
gh pr create --title "${PR_TITLE}" \
--body "${PR_BODY}" \
--assignee ${{ github.actor }} \
--label ${{ inputs.sync_pr_label }} \
--head ${{ inputs.release_branch }} \
--base ${{ inputs.develop_branch }}