@@ -24,24 +24,28 @@ jobs:
24
24
branch-major : ${{ steps.branchnames.outputs.major-branch }}
25
25
branch-minor : ${{ steps.branchnames.outputs.minor-branch }}
26
26
branch-patch : ${{ steps.branchnames.outputs.patch-branch }}
27
+ previous-tag : ${{ steps.getprevioustag.outputs.previous-tag }}
27
28
28
29
steps :
29
30
- name : Check out code
30
31
uses : actions/checkout@v3
31
32
with :
32
33
fetch-depth : 0
34
+ tags : true
33
35
34
36
- name : Get Previous Tag
35
- id : previoustag
36
- uses : " WyriHaximus/github-action-get-previous-tag@v1"
37
- with :
38
- fallback : 0.0.0
37
+ id : getprevioustag
38
+ run : |
39
+ previous_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
40
+ echo "Previous Tag: $previous_tag"
41
+ echo "previous_tag=$previous_tag" >> $GITHUB_ENV
42
+ echo "::set-output name=previous-tag::$previous_tag"
39
43
40
44
- name : Get Next Versions
41
45
id : nexttag
42
46
uses : " WyriHaximus/github-action-next-semvers@v1"
43
47
with :
44
- version : ${{ steps.previoustag .outputs.tag }}
48
+ version : ${{ steps.getprevioustag .outputs.previous- tag }}
45
49
46
50
- name : Build Branch Names
47
51
id : branchnames
@@ -105,46 +109,88 @@ jobs:
105
109
if : ${{ github.event.inputs.release-type == 'major' }}
106
110
run : |
107
111
new_version=${{ needs.determine-next-versions.outputs.next-major }}
112
+ awk -v new_version="$new_version" '
113
+ {
114
+ if ($0 ~ /^ s.version/) {
115
+ print " s.version = \x27" new_version "\x27"
116
+ } else {
117
+ print $0
118
+ }
119
+ }' ios/passage_flutter.podspec > temp_podspec.podspec
120
+ mv temp_podspec.podspec ios/passage_flutter.podspec
108
121
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
109
- sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
110
122
echo "Updated to major version $new_version"
111
123
112
124
- name : Update minor version in pubspec.yaml and podspec
113
125
if : ${{ github.event.inputs.release-type == 'minor' }}
114
126
run : |
115
127
new_version=${{ needs.determine-next-versions.outputs.next-minor }}
128
+ awk -v new_version="$new_version" '
129
+ {
130
+ if ($0 ~ /^ s.version/) {
131
+ print " s.version = \x27" new_version "\x27"
132
+ } else {
133
+ print $0
134
+ }
135
+ }' ios/passage_flutter.podspec > temp_podspec.podspec
136
+ mv temp_podspec.podspec ios/passage_flutter.podspec
116
137
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
117
- sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
118
138
echo "Updated to minor version $new_version"
119
139
120
140
- name : Update patch version in pubspec.yaml and podspec
121
141
if : ${{ github.event.inputs.release-type == 'patch' }}
122
142
run : |
123
143
new_version=${{ needs.determine-next-versions.outputs.next-patch }}
144
+ awk -v new_version="$new_version" '
145
+ {
146
+ if ($0 ~ /^ s.version/) {
147
+ print " s.version = \x27" new_version "\x27"
148
+ } else {
149
+ print $0
150
+ }
151
+ }' ios/passage_flutter.podspec > temp_podspec.podspec
152
+ mv temp_podspec.podspec ios/passage_flutter.podspec
124
153
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
125
- sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
126
154
echo "Updated to patch version $new_version"
127
155
128
- - name : Update CHANGELOG.md - major release
156
+ - name : Prepend to CHANGELOG.md - major release
129
157
if : ${{ github.event.inputs.release-type == 'major' }}
130
158
run : |
131
159
new_version=${{ needs.determine-next-versions.outputs.next-major }}
132
- echo "## $new_version\n\n- Description of changes\n" >> CHANGELOG.md
133
- echo "Updated CHANGELOG.md with version $new_version"
134
-
135
- - name : Update CHANGELOG.md - minor release
160
+ previous_tag=${{ needs.determine-next-versions.outputs.previous-tag }}
161
+ git fetch --tags
162
+ git fetch --all
163
+ git log -1
164
+ release_notes=$(git log --pretty=format:"* %s" $previous_tag..HEAD)
165
+ echo "Release Notes: $release_notes"
166
+ echo -e "## $new_version\n\n$release_notes\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
167
+ echo "Prepended CHANGELOG.md with version $new_version"
168
+
169
+ - name : Prepend to CHANGELOG.md - minor release
136
170
if : ${{ github.event.inputs.release-type == 'minor' }}
137
171
run : |
138
172
new_version=${{ needs.determine-next-versions.outputs.next-minor }}
139
- echo "## $new_version\n\n- Description of changes\n" >> CHANGELOG.md
140
- echo "Updated CHANGELOG.md with version $new_version"
141
-
142
- - name : Update CHANGELOG.md - patch release
173
+ previous_tag=${{ needs.determine-next-versions.outputs.previous-tag }}
174
+ git fetch --tags
175
+ git fetch --all
176
+ git log -1
177
+ release_notes=$(git log --pretty=format:"* %s" $previous_tag..HEAD)
178
+ echo "Release Notes: $release_notes"
179
+ echo -e "## $new_version\n\n$release_notes\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
180
+ echo "Prepended CHANGELOG.md with version $new_version"
181
+
182
+ - name : Prepend to CHANGELOG.md - patch release
143
183
if : ${{ github.event.inputs.release-type == 'patch' }}
144
184
run : |
145
185
new_version=${{ needs.determine-next-versions.outputs.next-patch }}
146
- echo "## $new_version\n\n- Description of changes\n" >> CHANGELOG.md
147
- echo "Updated CHANGELOG.md with version $new_version"
186
+ previous_tag=${{ needs.determine-next-versions.outputs.previous-tag }}
187
+ git fetch --tags
188
+ git fetch --all
189
+ git log -1
190
+ release_notes=$(git log --pretty=format:"* %s" $previous_tag..HEAD)
191
+ echo "Release Notes: $release_notes"
192
+ echo -e "## $new_version\n\n$release_notes\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
193
+ echo "Prepended CHANGELOG.md with version $new_version"
148
194
149
195
- name : Commit major version change
150
196
uses : stefanzweifel/git-auto-commit-action@v4
0 commit comments