Skip to content

Commit

Permalink
Merge pull request #45 from passageidentity/PSG-3992
Browse files Browse the repository at this point in the history
Psg 3992
  • Loading branch information
SinaSeylani authored Jun 5, 2024
2 parents a81b186 + 6518e90 commit b5dbc5e
Showing 1 changed file with 65 additions and 19 deletions.
84 changes: 65 additions & 19 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,28 @@ jobs:
branch-major: ${{ steps.branchnames.outputs.major-branch }}
branch-minor: ${{ steps.branchnames.outputs.minor-branch }}
branch-patch: ${{ steps.branchnames.outputs.patch-branch }}
previous-tag: ${{ steps.getprevioustag.outputs.previous-tag }}

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
tags: true

- name: Get Previous Tag
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.0
id: getprevioustag
run: |
previous_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "Previous Tag: $previous_tag"
echo "previous_tag=$previous_tag" >> $GITHUB_ENV
echo "::set-output name=previous-tag::$previous_tag"
- name: Get Next Versions
id: nexttag
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
version: ${{ steps.getprevioustag.outputs.previous-tag }}

- name: Build Branch Names
id: branchnames
Expand Down Expand Up @@ -105,46 +109,88 @@ jobs:
if: ${{ github.event.inputs.release-type == 'major' }}
run: |
new_version=${{ needs.determine-next-versions.outputs.next-major }}
awk -v new_version="$new_version" '
{
if ($0 ~ /^ s.version/) {
print " s.version = \x27" new_version "\x27"
} else {
print $0
}
}' ios/passage_flutter.podspec > temp_podspec.podspec
mv temp_podspec.podspec ios/passage_flutter.podspec
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
echo "Updated to major version $new_version"
- name: Update minor version in pubspec.yaml and podspec
if: ${{ github.event.inputs.release-type == 'minor' }}
run: |
new_version=${{ needs.determine-next-versions.outputs.next-minor }}
awk -v new_version="$new_version" '
{
if ($0 ~ /^ s.version/) {
print " s.version = \x27" new_version "\x27"
} else {
print $0
}
}' ios/passage_flutter.podspec > temp_podspec.podspec
mv temp_podspec.podspec ios/passage_flutter.podspec
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
echo "Updated to minor version $new_version"
- name: Update patch version in pubspec.yaml and podspec
if: ${{ github.event.inputs.release-type == 'patch' }}
run: |
new_version=${{ needs.determine-next-versions.outputs.next-patch }}
awk -v new_version="$new_version" '
{
if ($0 ~ /^ s.version/) {
print " s.version = \x27" new_version "\x27"
} else {
print $0
}
}' ios/passage_flutter.podspec > temp_podspec.podspec
mv temp_podspec.podspec ios/passage_flutter.podspec
sed -i "s/version: .*/version: $new_version/" pubspec.yaml
sed -i "s/s.version = '.*'/s.version = '$new_version'/" ios/passage_flutter.podspec
echo "Updated to patch version $new_version"
- name: Update CHANGELOG.md - major release
- name: Prepend to CHANGELOG.md - major release
if: ${{ github.event.inputs.release-type == 'major' }}
run: |
new_version=${{ needs.determine-next-versions.outputs.next-major }}
echo "## $new_version\n\n- Description of changes\n" >> CHANGELOG.md
echo "Updated CHANGELOG.md with version $new_version"
- name: Update CHANGELOG.md - minor release
previous_tag=${{ needs.determine-next-versions.outputs.previous-tag }}
git fetch --tags
git fetch --all
git log -1
release_notes=$(git log --pretty=format:"* %s" $previous_tag..HEAD)
echo "Release Notes: $release_notes"
echo -e "## $new_version\n\n$release_notes\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
echo "Prepended CHANGELOG.md with version $new_version"
- name: Prepend to CHANGELOG.md - minor release
if: ${{ github.event.inputs.release-type == 'minor' }}
run: |
new_version=${{ needs.determine-next-versions.outputs.next-minor }}
echo "## $new_version\n\n- Description of changes\n" >> CHANGELOG.md
echo "Updated CHANGELOG.md with version $new_version"
- name: Update CHANGELOG.md - patch release
previous_tag=${{ needs.determine-next-versions.outputs.previous-tag }}
git fetch --tags
git fetch --all
git log -1
release_notes=$(git log --pretty=format:"* %s" $previous_tag..HEAD)
echo "Release Notes: $release_notes"
echo -e "## $new_version\n\n$release_notes\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
echo "Prepended CHANGELOG.md with version $new_version"
- name: Prepend to CHANGELOG.md - patch release
if: ${{ github.event.inputs.release-type == 'patch' }}
run: |
new_version=${{ needs.determine-next-versions.outputs.next-patch }}
echo "## $new_version\n\n- Description of changes\n" >> CHANGELOG.md
echo "Updated CHANGELOG.md with version $new_version"
previous_tag=${{ needs.determine-next-versions.outputs.previous-tag }}
git fetch --tags
git fetch --all
git log -1
release_notes=$(git log --pretty=format:"* %s" $previous_tag..HEAD)
echo "Release Notes: $release_notes"
echo -e "## $new_version\n\n$release_notes\n\n$(cat CHANGELOG.md)" > CHANGELOG.md
echo "Prepended CHANGELOG.md with version $new_version"
- name: Commit major version change
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down

0 comments on commit b5dbc5e

Please sign in to comment.