Skip to content

Commit b5dbc5e

Browse files
authored
Merge pull request #45 from passageidentity/PSG-3992
Psg 3992
2 parents a81b186 + 6518e90 commit b5dbc5e

File tree

1 file changed

+65
-19
lines changed

1 file changed

+65
-19
lines changed

.github/workflows/create-release.yml

+65-19
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,28 @@ jobs:
2424
branch-major: ${{ steps.branchnames.outputs.major-branch }}
2525
branch-minor: ${{ steps.branchnames.outputs.minor-branch }}
2626
branch-patch: ${{ steps.branchnames.outputs.patch-branch }}
27+
previous-tag: ${{ steps.getprevioustag.outputs.previous-tag }}
2728

2829
steps:
2930
- name: Check out code
3031
uses: actions/checkout@v3
3132
with:
3233
fetch-depth: 0
34+
tags: true
3335

3436
- 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"
3943
4044
- name: Get Next Versions
4145
id: nexttag
4246
uses: "WyriHaximus/github-action-next-semvers@v1"
4347
with:
44-
version: ${{ steps.previoustag.outputs.tag }}
48+
version: ${{ steps.getprevioustag.outputs.previous-tag }}
4549

4650
- name: Build Branch Names
4751
id: branchnames
@@ -105,46 +109,88 @@ jobs:
105109
if: ${{ github.event.inputs.release-type == 'major' }}
106110
run: |
107111
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
108121
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
109-
sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
110122
echo "Updated to major version $new_version"
111123
112124
- name: Update minor version in pubspec.yaml and podspec
113125
if: ${{ github.event.inputs.release-type == 'minor' }}
114126
run: |
115127
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
116137
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
117-
sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
118138
echo "Updated to minor version $new_version"
119139
120140
- name: Update patch version in pubspec.yaml and podspec
121141
if: ${{ github.event.inputs.release-type == 'patch' }}
122142
run: |
123143
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
124153
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
125-
sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
126154
echo "Updated to patch version $new_version"
127155
128-
- name: Update CHANGELOG.md - major release
156+
- name: Prepend to CHANGELOG.md - major release
129157
if: ${{ github.event.inputs.release-type == 'major' }}
130158
run: |
131159
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
136170
if: ${{ github.event.inputs.release-type == 'minor' }}
137171
run: |
138172
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
143183
if: ${{ github.event.inputs.release-type == 'patch' }}
144184
run: |
145185
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"
148194
149195
- name: Commit major version change
150196
uses: stefanzweifel/git-auto-commit-action@v4

0 commit comments

Comments
 (0)