-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 3.72 KB
/
create-versioning-pr.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Create versioning pull request
on:
push:
branches: ["main"]
paths-ignore:
- README.md
jobs:
version:
name: Get versioning information
runs-on: ubuntu-latest
outputs:
next_release_version: ${{ steps.get_versioning_information.outputs.next_release_version }}
has_unreleased_changes: ${{ steps.get_versioning_information.outputs.has_unreleased_changes }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Get all tags
- name: Get versioning information
uses: ./.github/actions/get-versioning-information
id: get_versioning_information
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
versioning_pr:
name: Create versioning pull request
needs: [version]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: needs.version.outputs.has_unreleased_changes == 'true'
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0 # Get all tags
persist-credentials: false # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
- name: Download auto
run: |
curl -kL -o - https://github.com/intuit/auto/releases/download/v11.3.0/auto-linux.gz | gunzip > ${{ runner.temp }}/auto
chmod +x ${{ runner.temp }}/auto
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Get GitHub App email address
id: get-user-email
run: echo "email=${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
- name: Get GitHub App display name
id: get-user-name
run: echo "name=${{ steps.app-token.outputs.app-slug }}[bot]" >> "$GITHUB_OUTPUT"
- name: Update changelog
id: update_changelog
run: |
echo "changes<<EOF" >> $GITHUB_ENV
echo "$(${{ runner.temp }}/auto changelog --quiet --no-git-commit --name ${{ steps.get-user-name.outputs.name }} --email ${{ steps.get-user-email.outputs.email }})" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Create versioning pull request
uses: peter-evans/create-pull-request@v7
with:
branch: auto/release
title: Release version `${{ needs.version.outputs.next_release_version }}`
commit-message: Release version `${{ needs.version.outputs.next_release_version }}`
labels: |
release
chore
body: |
This PR will release version `${{ needs.version.outputs.next_release_version }}`
## Changes
${{ env.changes }}
## Releasing a new version
To release the version when you are ready, merge this PR. The new version will then be built and published to a GitHub release.
If you don't see your changes in the list above, please check your PR is tagged with an appropriate label to include your change in the release notes.
token: ${{ steps.app-token.outputs.token }}
author: ${{ steps.get-user-name.outputs.name }} <${{ steps.get-user-email.outputs.email }}>
committer: ${{ steps.get-user-name.outputs.name }} <${{ steps.get-user-email.outputs.email }}>