forked from rpm-software-management/dnf5
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (33 loc) · 1.36 KB
/
Copy pathdo-release.yaml
File metadata and controls
38 lines (33 loc) · 1.36 KB
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
# from: https://github.com/packit/packit/blob/main/.github/workflows/do_release.yml
name: Create a GitHub release once a release PR is merged
on:
workflow_dispatch:
pull_request:
types:
- closed
jobs:
if_merged:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') && github.repository_owner == 'rpm-software-management'
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.RSM_CI_APP_ID }}
private-key: ${{ secrets.RSM_CI_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Create GitHub release
run: |
VERSION=$(grep -oP '^# \K[0-9.]*' CHANGELOG.md | head -n 1)
# Take the lines between the first two headers from CHANGELOG.md,
# and use it as a description for the new release.
CHANGELOG=$(awk 'BEGIN { first = 0 } /^# / { if (first == 0) { first = 1 } else { exit } } /^[^#]/ { print $0 }' CHANGELOG.md)
gh release create ${VERSION} \
--target ${{ github.event.pull_request.base.ref }} \
--draft \
--title ${VERSION} \
-n "${CHANGELOG}"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}