-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (52 loc) · 2.15 KB
/
update-changelog.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
# This is a basic workflow that is manually triggered
name: Update Changelog
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
createBuild:
description: 'Create compiled executable?'
default: 'true'
required: true
jobs:
update-changelog:
runs-on: macos-latest
steps:
- name: Check Acccess
uses: sushichop/action-repository-permission@v1
with:
required-permission: admin
- name: Checkout
uses: actions/checkout@v2
- name: Create branch
run: git checkout -b create-release
- name: Create binary
if: github.event.inputs.createBuild == 'true'
run: |
swift build -c release --arch arm64 --arch x86_64
cp .build/apple/Products/Release/changelog ./
- name: Update changelog
run: |
MAC_OS_VERSION=$([[ "$OSTYPE" == "darwin"* ]] && sw_vers -productVersion)
major="$(echo $MAC_OS_VERSION | awk 'BEGIN { FS="." } { print $1 }')"
# For macOS 11 or lower while async/await works, it doesn't seem to work using the precompiled binary
can_run_compiled_binary="$(if [[ $major -lt 12 ]]; then echo 'false'; else echo 'true'; fi)"
if [[ "$OSTYPE" == "darwin"* && "$can_run_compiled_binary" == "true" ]]; then
./changelog generate --repository=${{ github.repository }} --token=${{ secrets.GITHUB_TOKEN }} --output=./CHANGELOG.md --next-tag=v${{ github.event.inputs.version }}
else
swift run changelog generate --repository=${{ github.repository }} --token=${{ secrets.GITHUB_TOKEN }} --output=./CHANGELOG.md --next-tag=v${{ github.event.inputs.version }}
fi
- name: Push branch
run: |
git push origin create-release --force
- name: Create PR
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: create-release
base: main
commit-message: "Create release v${{ github.event.inputs.version }}"
title: "Create release v${{ github.event.inputs.version }}"
body: ":crown: Create release v${{ github.event.inputs.version }}"