7
7
description : ' Version to release'
8
8
required : true
9
9
10
+ permissions :
11
+ contents : write
12
+
10
13
jobs :
11
14
release :
12
15
runs-on : ubuntu-latest
13
16
17
+ name : Release ${{ inputs.version }}
18
+
19
+ outputs :
20
+ version : ${{ steps.version.outputs.version }}
21
+ notes : ${{ steps.cleaned-notes.outputs.release-notes }}
22
+
14
23
steps :
15
24
- name : Checkout repository
16
25
uses : actions/checkout@v4
21
30
VERSION=${{ inputs.version }}
22
31
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
23
32
33
+ - name : Check if branch and version match
34
+ id : guard
35
+ run : |
36
+ MAJOR_VERSION="${NUMERIC_VERSION%%.*}"
37
+ BRANCH_MAJOR_VERSION="${BRANCH%%.*}"
38
+
39
+ echo "MAJOR_VERSION=$(echo $MAJOR_VERSION)" >> $GITHUB_OUTPUT;
40
+ echo "BRANCH_MAJOR_VERSION=$(echo $BRANCH_MAJOR_VERSION)" >> $GITHUB_OUTPUT;
41
+
42
+ if [ "$MAJOR_VERSION" != "$BRANCH_MAJOR_VERSION" ]; then
43
+ echo "Mismatched versions! Aborting."
44
+ VERSION_MISMATCH='true';
45
+ else
46
+ echo "Versions match! Proceeding."
47
+ VERSION_MISMATCH='false';
48
+ fi
49
+
50
+ echo "VERSION_MISMATCH=$(echo $VERSION_MISMATCH)" >> $GITHUB_OUTPUT;
51
+ env :
52
+ BRANCH : ${{ github.ref_name }}
53
+ NUMERIC_VERSION : ${{ steps.version.outputs.version }}
54
+
55
+ - name : Fail if branch and release tag do not match
56
+ if : ${{ steps.guard.outputs.VERSION_MISMATCH == 'true' }}
57
+ uses : actions/github-script@v7
58
+ with :
59
+ script : |
60
+ core.setFailed('Workflow failed. Release version does not match with selected target branch. Did you select the correct branch?')
61
+
24
62
- name : Update Application.php version
25
63
run : sed -i "s/const VERSION = '.*';/const VERSION = '${{ steps.version.outputs.version }}';/g" src/Illuminate/Foundation/Application.php
26
64
@@ -41,24 +79,40 @@ jobs:
41
79
bash ./bin/release.sh v${{ steps.version.outputs.version }}
42
80
script_stop : true
43
81
44
- # - name: Generate release notes
45
- # id: notes
46
- # uses: RedCrafter07/release-notes-action@main
47
- # with:
48
- # tag-name: v${{ steps.version.outputs.version }}
49
- # token: ${{ secrets.GITHUB_TOKEN }}
50
- # branch: ${{ github.ref_name }}
51
-
52
- # - name: Cleanup release notes
53
- # run: |
54
- # sed -i '/## What/d' ${{ steps.notes.outputs.release-notes }}
55
- # sed -i '/## New Contributors/,$d' ${{ steps.notes.outputs.release-notes }}
56
-
57
- # - name: Create release
58
- # uses: softprops/action-gh-release@v1
59
- # env:
60
- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
- # with:
62
- # tag_name: v${{ steps.version.outputs.version }}
63
- # name: v${{ steps.version.outputs.version }}
64
- # body: ${{ steps.notes.outputs.release-notes }}
82
+ - name : Generate release notes
83
+ id : generated-notes
84
+ uses : RedCrafter07/release-notes-action@main
85
+ with :
86
+ tag-name : v${{ steps.version.outputs.version }}
87
+ token : ${{ secrets.GITHUB_TOKEN }}
88
+ branch : ${{ github.ref_name }}
89
+
90
+ - name : Cleanup release notes
91
+ id : cleaned-notes
92
+ run : |
93
+ NOTES="${{ steps.generated-notes.outputs.release-notes }}"
94
+ NOTES=$(echo $NOTES | sed '/## What/d')
95
+ NOTES=$(echo $NOTES | sed '/## New Contributors/,$d')
96
+ echo "release-notes=${NOTES}" >> "$GITHUB_OUTPUT"
97
+
98
+ - name : Create release
99
+ uses : softprops/action-gh-release@v2
100
+ env :
101
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
102
+ with :
103
+ tag_name : v${{ steps.version.outputs.version }}
104
+ name : v${{ steps.version.outputs.version }}
105
+ body : ${{ steps.cleaned-notes.outputs.release-notes }}
106
+ target_commitish : ${{ github.ref_name }}
107
+ make_latest : ' legacy'
108
+
109
+ update-changelog :
110
+ needs : release
111
+
112
+ name : Update changelog
113
+
114
+ uses : laravel/.github/.github/workflows/update-changelog.yml@main
115
+ with :
116
+ branch : ${{ github.ref_name }}
117
+ version : " v${{ needs.release.outputs.version }}"
118
+ notes : ${{ needs.release.outputs.notes }}
0 commit comments