generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: CE-882 versioning on prod releasesv2 #668
Merged
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5e1f3c0
Tag and Release
barrfalk 1b71514
Update pr-version-bump.yml
barrfalk 609e2a2
feat: Update pr-version-bump.yml (#669)
barrfalk 7e0e224
Merge branch 'release/orca' into CE-882-Versioning-on-Prod-Releasesv2
barrfalk 299c157
feat: Update pr-version-bump.yml (#670)
barrfalk 9368056
Ce 882 test (#671)
barrfalk 0130e63
feat: CE-882 test (#672)
barrfalk 4df68e5
feat: CE-882 test (#673)
barrfalk df78f46
feat: CE-882 test (#674)
barrfalk c005d5c
feat: CE-882 test (#675)
barrfalk 44b2f84
feat: CE-882 test (#676)
barrfalk 08d19a3
feat: CE-882 test (#677)
barrfalk 99d72a0
Update pr-version-bump.yml
barrfalk e022a2f
Update release-branch-creation.yml
barrfalk 72af854
Update pr-version-bump.yml
barrfalk 5ae712c
Merge branch 'release/orca' into CE-882-Versioning-on-Prod-Releasesv2
afwilcox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Handle PR Merge and Version Update | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- release/** | ||
jobs: | ||
handle_pr: | ||
name: Handle Merged PR | ||
runs-on: ubuntu-22.04 | ||
if: ${{ github.event.pull_request.merged == true }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Fetch all tags | ||
run: git fetch --tags --force | ||
|
||
- name: Fetch tags from main | ||
id: get_latest_tag | ||
run: | | ||
git fetch origin main --tags | ||
latest_tag=$(git describe --tags --abbrev=0 origin/main) | ||
echo "::set-output name=latest_tag::$latest_tag" | ||
echo "Latest tag: $latest_tag" | ||
|
||
- name: Increment Patch Version | ||
id: increment_version | ||
run: | | ||
latest_tag=${{ steps.get_latest_tag.outputs.latest_tag }} | ||
version_array=(${latest_tag//./ }) | ||
patch_version=${version_array[2]} | ||
new_patch_version=$((patch_version + 1)) | ||
new_version="${version_array[0]}.${version_array[1]}.${new_patch_version}" | ||
echo "::set-output name=new_version::$new_version" | ||
echo "New version: $new_version" | ||
|
||
- name: Update package.json versions | ||
run: | | ||
# Update package.json in the frontend directory | ||
cd frontend | ||
npm version ${{ steps.increment_version.outputs.new_version }} --no-git-tag-version | ||
echo "Frontend package.json version updated to ${{ steps.increment_version.outputs.new_version }}" | ||
|
||
# Update package.json in the backend directory | ||
cd ../backend | ||
npm version ${{ steps.increment_version.outputs.new_version }} --no-git-tag-version | ||
echo "Backend package.json version updated to ${{ steps.increment_version.outputs.new_version }}" | ||
|
||
# Update package.json in the webeoc directory | ||
cd ../webeoc | ||
npm version ${{ steps.increment_version.outputs.new_version }} --no-git-tag-version | ||
echo "WebEOC package.json version updated to ${{ steps.increment_version.outputs.new_version }}" | ||
|
||
# Return to the original directory | ||
cd .. | ||
|
||
- name: Commit and Push Version Update | ||
run: | | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
git add frontend/package.json backend/package.json webeoc/package.json | ||
git commit -m "chore: bump version to ${{ steps.increment_version.outputs.new_version }}" | ||
git push origin HEAD:refs/heads/${{ github.head_ref }} | ||
|
||
- name: Create Git Tag | ||
run: | | ||
git tag "${{ steps.increment_version.outputs.new_version }}" | ||
git push origin "${{ steps.increment_version.outputs.new_version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Create New Tag on Release Branch Creation | ||
|
||
on: | ||
create: | ||
|
||
jobs: | ||
bump_minor_version: | ||
name: Bump Minor Version and Create New Tag | ||
runs-on: ubuntu-22.04 | ||
# Only trigger for main release branches | ||
if: startsWith(github.ref, 'refs/heads/release/') && !contains(github.ref, '/') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install npm | ||
run: sudo apt-get install -y npm | ||
|
||
# Fetch the latest tag (sort by creation date) | ||
- name: Fetch latest tag | ||
id: latest_tag | ||
run: | | ||
git fetch --tags | ||
latest_tag=$(git tag --sort=-creatordate | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1) | ||
if [ -z "$latest_tag" ]; then | ||
echo "No previous tags found, starting with v0.1.0" | ||
latest_tag="v0.0.0" | ||
fi | ||
echo "::set-output name=latest_tag::$latest_tag" | ||
echo "Latest tag: $latest_tag" | ||
|
||
# Bump the minor version and reset the patch to 0 | ||
- name: Bump minor version | ||
id: bump_version | ||
run: | | ||
latest_tag="${{ steps.latest_tag.outputs.latest_tag }}" | ||
# Extract major, minor, and patch versions | ||
version_array=(${latest_tag//./ }) | ||
major_version=${version_array[0]//v/} | ||
minor_version=${version_array[1]} | ||
patch_version=${version_array[2]} | ||
# Increment minor version and reset patch | ||
new_minor_version=$((minor_version + 1)) | ||
new_version="v${major_version}.${new_minor_version}.0" | ||
echo "::set-output name=new_version::$new_version" | ||
echo "New version: $new_version" | ||
|
||
# Create a new tag with the bumped minor version | ||
- name: Create and push the new tag | ||
run: | | ||
new_version="${{ steps.bump_version.outputs.new_version }}" | ||
git tag "$new_version" | ||
git push origin "$new_version" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think yml file supports comment inside a block scalar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!