7
7
workflow_dispatch :
8
8
inputs :
9
9
version :
10
- description : ' Version to release (optional)'
11
- required : false
10
+ description : ' The version to release'
12
11
type : string
13
12
14
- concurrency :
15
- group : release-${{ github.workflow }}-${{ github.ref }}
16
- cancel-in-progress : true
17
-
18
13
permissions :
19
14
contents : write
20
15
pull-requests : read
21
16
statuses : write
17
+ packages : write
22
18
23
19
jobs :
24
- continuous :
25
- name : Continuous
26
- runs-on : ubuntu-latest
20
+ release :
21
+ name : Release
22
+ runs-on : ' ubuntu-latest'
23
+ timeout-minutes : 15
24
+ if : " !startsWith(github.event.head_commit.message, '[Release]')"
27
25
steps :
28
- - uses : actions/checkout@v4
29
- - name : Determine version
30
- id : get_version
31
- run : |
32
- if [ -n "${{ github.event.inputs.version }}" ]; then
33
- echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
34
- else
35
- echo "No version provided, calculating next version..."
36
- fi
37
- - uses : rmeneely/git-next-version@v1
26
+ - uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
38
27
with :
39
- tag_pattern : ' [0-9]*.[0-9]*.[0-9]*'
40
- increment : ' minor'
41
- - name : Set final version
42
- id : set_version
28
+ fetch-depth : 0
29
+ - uses : jdx/mise-action@v2
30
+ with :
31
+ experimental : true
32
+ - name : Check if there are releasable changes
33
+ id : is-releasable
43
34
run : |
44
- if [ -n "${{ steps.get_version.outputs.VERSION }}" ]; then
45
- echo "version=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
35
+ # Run git cliff and save the output
36
+ bumped_output=$(git cliff --bump)
37
+ echo "Bumped output:"
38
+ echo "${bumped_output}"
39
+
40
+ # Read the content of CHANGELOG.md
41
+ changelog_content=$(cat CHANGELOG.md)
42
+ echo "CHANGELOG.md content:"
43
+ echo "${changelog_content}"
44
+
45
+ # Compare the outputs and set the result
46
+ if [ "${bumped_output}" = "${changelog_content}" ]; then
47
+ echo "should-release=false" >> $GITHUB_ENV
46
48
else
47
- echo "version=${{ env.NEXT_VERSION }} " >> $GITHUB_OUTPUT
49
+ echo "should-release=true " >> $GITHUB_ENV
48
50
fi
49
- - name : " Generate Tuist Changelog"
50
- id : changelog
51
- uses : mikepenz/release-changelog-builder-action@v4
52
- with :
53
- owner : " tuist"
54
- repo : " XcodeGraph"
55
- configuration : " .github/changelog-configuration.json"
51
+
52
+ - name : Get next version
53
+ id : next-version
54
+ if : env.should-release == 'true'
55
+ env :
56
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57
+ run : echo "NEXT_VERSION=$(git cliff --bumped-version)" >> "$GITHUB_OUTPUT"
58
+ - name : Get release notes
59
+ id : release-notes
60
+ if : env.should-release == 'true'
56
61
env :
57
62
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58
- - name : Check if there are categorized PRs
59
- id : check_prs
60
63
run : |
61
- if [ "${{ steps.changelog.outputs.categorized_prs }}" = "0" ]; then
62
- echo "skip_next_steps=true" >> $GITHUB_OUTPUT
63
- else
64
- echo "skip_next_steps=false" >> $GITHUB_OUTPUT
65
- fi
66
- - name : Update Changelog
67
- uses : stefanzweifel/changelog-updater-action@v1
68
- if : steps.check_prs.outputs.skip_next_steps != 'true'
69
- with :
70
- latest-version : ${{ steps.set_version.outputs.version }}
71
- release-notes : ${{ steps.changelog.outputs.changelog }}
72
- path-to-changelog : CHANGELOG.md
73
- - uses : stefanzweifel/git-auto-commit-action@v5
74
- if : steps.check_prs.outputs.skip_next_steps != 'true'
64
+ echo "RELEASE_NOTES<<EOF" >> "$GITHUB_OUTPUT"
65
+ git cliff --unreleased >> "$GITHUB_OUTPUT"
66
+ echo "EOF" >> "$GITHUB_OUTPUT"
67
+ - name : Update CHANGELOG.md
68
+ if : env.should-release == 'true'
69
+ env :
70
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71
+ run : git cliff --bump -o CHANGELOG.md
72
+ - name : Commit changes
73
+ id : auto-commit-action
74
+ uses : stefanzweifel/git-auto-commit-action@v5
75
+ if : env.should-release == 'true'
75
76
with :
76
- commit_message : " Version ${{ steps.set_version.outputs.version }}"
77
- tagging_message : ${{ steps.set_version.outputs.version }}
78
77
commit_options : ' --allow-empty'
79
- - name : Create GitHub Release on the tuist/XcodeGraph repository
80
- if : steps.check_prs.outputs.skip_next_steps != 'true'
81
- uses : softprops/action-gh-release@v1
78
+ tagging_message : ${{ steps.next-version.outputs.NEXT_VERSION }}
79
+ skip_dirty_check : true
80
+ commit_message : " [Release] XcodeGraph ${{ steps.next-version.outputs.NEXT_VERSION }}"
81
+ - name : Create GitHub Release
82
+ uses : softprops/action-gh-release@v2
83
+ if : env.should-release == 'true'
82
84
with :
83
85
draft : false
84
86
repository : tuist/XcodeGraph
85
- name : ${{ steps.set_version.outputs.version }}
86
- tag_name : ${{ steps.set_version.outputs.version }}
87
- body : ${{ steps.changelog.outputs.changelog }}
87
+ name : ${{ steps.next-version.outputs.NEXT_VERSION }}
88
+ tag_name : ${{ steps.next-version.outputs.NEXT_VERSION }}
89
+ body : ${{ steps.release-notes.outputs.RELEASE_NOTES }}
90
+ target_commitish : ${{ steps.auto-commit-action.outputs.commit_hash }}
0 commit comments