-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (53 loc) · 2.08 KB
/
create-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
59
60
61
62
63
64
name: Create Release
on:
pull_request:
types: [closed]
jobs:
create-release:
runs-on: macos-latest
if: github.event.pull_request.merged == true && github.head_ref == 'create-release'
steps:
- uses: actions/checkout@v2
- name: Get app version
id: get-version
working-directory: Sources
run: |
# expecting Create release <tag-version>
title="${{ github.event.pull_request.title }}"
tag="${title:15}"
echo "::set-output name=tag::$tag"
- name: Update tag
uses: richardsimko/update-tag@v1
with:
tag_name: "${{ steps.get-version.outputs.tag }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Changelog
id: get-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
output=$(./changelog generate --repository=${{ github.repository }} --token=${{ secrets.GITHUB_TOKEN }} --disable-logging)
else
output=$(swift run changelog generate --repository=${{ github.repository }} --token=${{ secrets.GITHUB_TOKEN }} --disable-logging)
fi
# Multiline output is not supported by GitHub Actions
echo 'CHANGELOG_VALUE<<EOF' >> $GITHUB_ENV
echo $output >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo "::set-output name=changelog::$output"
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
tag: "${{ steps.get-version.outputs.tag }}"
body: |
"${{ env.CHANGELOG_VALUE }}"
generateReleaseNotes: true
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "changelog"