-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CI/CD Merging from next (#183)
* Push new workflows
- Loading branch information
Showing
2 changed files
with
115 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Attempt to merge next to main | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
# Check if next can merge into main | ||
perform_merge: | ||
name: Perform merge if "next" can merge into "main" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
repo-token: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} | ||
persist-credentials: true | ||
|
||
# Set user identity | ||
- name: Set-Identity | ||
run: | | ||
git config --global user.email "${{ secrets.GLOBAL_GITHUB_EMAIL }}" | ||
git config --global user.name "${{ secrets.GLOBAL_GITHUB_USER }}" | ||
# Checkout "main" | ||
- name: Checkout main | ||
run: git checkout "main" | ||
|
||
- name: Perform the merge from next to main | ||
run: | | ||
git merge next | ||
git push origin "main" | ||
echo "Push to main succeeded" | ||
# If the merge cannot be performed, let stakeholders know | ||
message_on_failure: | ||
name: Merge failure | ||
needs: perform_merge | ||
runs-on: ubuntu-latest | ||
if: ${{ failure() }} | ||
|
||
steps: | ||
- name: Post error message (To-Do) | ||
run: echo "Next cannot be merged into main cleanly" |
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,72 @@ | ||
name: Attempt to merge next to next-major | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "next" | ||
|
||
jobs: | ||
# Check if next can merge into next-major | ||
perform_merge: | ||
name: Perform merge if "next" can merge into "next-major" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
repo-token: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} | ||
persist-credentials: true | ||
|
||
# Set user identity | ||
- name: Set-Identity | ||
run: | | ||
git config --global user.email "${{ secrets.GLOBAL_GITHUB_EMAIL }}" | ||
git config --global user.name "${{ secrets.GLOBAL_GITHUB_USER }}" | ||
# Checkout "next-major" | ||
- name: Checkout next-major | ||
run: git checkout "next-major" | ||
|
||
# Get the "next-major" version number | ||
- name: Extract next-major version | ||
id: extract_version | ||
run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" | ||
|
||
# Checkout "next" | ||
- name: Checkout next | ||
run: git checkout "next" | ||
|
||
# Update "next" version to match "next-major" | ||
- name: Update "next" version to match "next-major" | ||
run: | | ||
jq '.version = "${{ steps.extract_version.outputs.version }}"' package.json > temp.json | ||
if diff -q "package.json" "temp.json" >/dev/null; then | ||
echo "Versions are identical. No change required." | ||
rm temp.json | ||
else | ||
mv temp.json package.json | ||
git add package.json && git commit -m "Sync version to ${{ steps.extract_version.outputs.version }}" | ||
fi | ||
# Checkout "next-major" | ||
- name: Checkout next-major | ||
run: git checkout "next-major" | ||
|
||
- name: Perform the merge from next to next-major | ||
run: | | ||
git merge next | ||
git push origin "next-major" | ||
echo "Push to next-major succeeded" | ||
# If the merge cannot be performed, let stakeholders know | ||
message_on_failure: | ||
name: Merge failure | ||
needs: perform_merge | ||
runs-on: ubuntu-latest | ||
if: ${{ failure() }} | ||
|
||
steps: | ||
- name: Post error message (To-Do) | ||
run: echo "Next cannot be merged into next-major cleanly" |