-
-
Notifications
You must be signed in to change notification settings - Fork 309
90 lines (84 loc) · 2.92 KB
/
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
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
name: Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
version:
description: "The version to release"
type: string
permissions:
contents: write
pull-requests: read
statuses: write
packages: write
jobs:
release:
name: Release
runs-on: "ubuntu-latest"
timeout-minutes: 15
if: "!startsWith(github.event.head_commit.message, '[Release]')"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- uses: jdx/mise-action@v2
with:
experimental: true
- name: Check if there are releasable changes
id: is-releasable
run: |
# Run git cliff and save the output
bumped_output=$(git cliff 8.22.0.. --bump)
echo "Bumped output:"
echo "${bumped_output}"
# Read the content of CHANGELOG.md
changelog_content=$(cat CHANGELOG.md)
echo "CHANGELOG.md content:"
echo "${changelog_content}"
# Compare the outputs and set the result
if [ "${bumped_output}" = "${changelog_content}" ]; then
echo "should-release=false" >> $GITHUB_ENV
else
echo "should-release=true" >> $GITHUB_ENV
fi
- name: Get next version
id: next-version
if: env.should-release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "NEXT_VERSION=$(git cliff 8.22.0.. --bumped-version)" >> "$GITHUB_OUTPUT"
- name: Get release notes
id: release-notes
if: env.should-release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "RELEASE_NOTES<<EOF" >> "$GITHUB_OUTPUT"
git cliff 8.22.0.. --bump --unreleased >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Update CHANGELOG.md
if: env.should-release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git cliff 8.22.0.. --bump -o CHANGELOG.md
- name: Commit changes
id: auto-commit-action
uses: stefanzweifel/git-auto-commit-action@v5
if: env.should-release == 'true'
with:
commit_options: "--allow-empty"
tagging_message: ${{ steps.next-version.outputs.NEXT_VERSION }}
skip_dirty_check: true
commit_message: "[Release] XcodeProj ${{ steps.next-version.outputs.NEXT_VERSION }}"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: env.should-release == 'true'
with:
draft: false
repository: tuist/XcodeProj
name: ${{ steps.next-version.outputs.NEXT_VERSION }}
tag_name: ${{ steps.next-version.outputs.NEXT_VERSION }}
body: ${{ steps.release-notes.outputs.RELEASE_NOTES }}
target_commitish: ${{ steps.auto-commit-action.outputs.commit_hash }}