-
Notifications
You must be signed in to change notification settings - Fork 20
74 lines (61 loc) · 2.7 KB
/
create-release-pr.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
name: Create Release PR
on:
pull_request:
branches:
- main
env:
git-user: kubeshop-bot
git-email: [email protected]
base-branch: main
source-branch: develop
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Sanitize version
run: |
VERSION=v0.0.0-test
echo "VERSION=$(echo "$VERSION" | sed "s/^v//")" >> "$GITHUB_ENV"
- name: Check out GitHub repo
uses: actions/checkout@v2
with:
ref: ${{ env.source-branch }}
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "${{ env.git-user }}"
git config user.email "${{ env.git-email }}"
- name: Create release branch
run: git checkout ${{ env.source-branch }} && git checkout -b release/v${{ env.VERSION }}
- name: Push release branch
run: git push origin release/v${{ env.VERSION }}
- name: Build log
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "CHANGELOG<<$EOF" >> "$GITHUB_ENV"
echo "$(git --no-pager log "origin/main..HEAD" --pretty='format:|[**`%h`**](https://github.com/kubeshop/testkube-dashboard/commit/%h) | %s |' 2>&1 | sed 's/ (#\([0-9]*\))[^"]/|([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/g' | sed 's/Merge pull request #\([0-9]*\)\(.*\)/Merge pull request #\1\2 | ([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/')" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
echo "FULL_CHANGELOG<<$EOF" >> "$GITHUB_ENV"
echo "$(git --no-pager log "origin/main..HEAD" --pretty='format:|[**`%h`**](https://github.com/kubeshop/testkube-dashboard/commit/%h)| %ci | %an | %s |' 2>&1 | sed 's/ (#\([0-9]*\))[^"]/|([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/g' | sed 's/Merge pull request #\([0-9]*\)\(.*\)/Merge pull request #\1\2 | ([#\1](https:\/\/github.com\/kubeshop\/testkube-dashboard\/pull\/\1))/')" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
base: ${{ env.base-branch }}
branch: release/v${{ env.VERSION }}
title: Release v${{ env.VERSION }}
labels: |
release
automated pr
assignees: ${{ github.triggering_actor }}
body: |
### Changelog
| Commit | Description | PR |
|-|-|-|
${{env.CHANGELOG}}
<details>
<summary>Details</summary>
| Commit | Date | Author | Description | PR |
|-|-|-|-|-|
${{env.FULL_CHANGELOG}}
</details>