-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
80 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,39 @@ | ||
name: Update Internal GHE Repo | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- '**' | ||
jobs: | ||
update-repo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout local repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: source | ||
|
||
- name: Checkout remote repo | ||
uses: actions/checkout@v4 | ||
with: | ||
github-server-url: https://github.ibm.com | ||
repository: automation-paas-cd-pipeline/mas-gitops | ||
ref: ${GITHUB_REF##*/} | ||
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | ||
path: target | ||
|
||
- name: Copy over files | ||
run: $GITHUB_WORKSPACE/build/bin/copy-gitops.sh -s $GITHUB_WORKSPACE/source -t $GITHUB_WORKSPACE/target | ||
|
||
- name: Setup git config | ||
run: | | ||
cd $GITHUB_WORKSPACE/target | ||
git config user.name "GitHub Actions Bot" | ||
git config user.email "<>" | ||
- name: Commit changes to remote repo | ||
run: | | ||
echo "Push changes to ${GITHUB_REF##*/} branch of https://github.ibm.com/automation-paas-cd-pipeline/mas-gitops" | ||
git push origin ${GITHUB_REF##*/} | ||
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,41 @@ | ||
#/bin/bash | ||
|
||
echo "build/bin/copy-gitops.sh -s <source ibm-mas/gitops directory> -t <target ibm-mas/gitops directory> " | ||
echo "" | ||
echo "Example usage: " | ||
echo " build/bin/copy-gitops.sh -s /Users/whitfiea/Work/Git/ibm-mas/gitops -t /Users/whitfiea/Work/Git/ibm-mas/mas-gitops" | ||
echo "" | ||
|
||
# Process command line arguments | ||
while [[ $# -gt 0 ]] | ||
do | ||
key="$1" | ||
shift | ||
case $key in | ||
-s|--source) | ||
SOURCE=$1 | ||
shift | ||
;; | ||
|
||
-t|--target) | ||
TARGET=$1 | ||
shift | ||
;; | ||
|
||
*) | ||
# unknown option | ||
echo -e "\nUsage Error: Unsupported flag \"${key}\"\n\n" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
: ${SOURCE?"Need to set -s|--source argument for source directory"} | ||
: ${TARGET?"Need to set -t|--target argument for target directory"} | ||
|
||
echo "Copying gitops" | ||
cp -vr ${SOURCE}/applications/* ${TARGET}/applications/ | ||
cp -vr ${SOURCE}/root-applications/* ${TARGET}/root-applications/ | ||
cp -vr ${SOURCE}/docs/* ${TARGET}/docs/ | ||
cp -vr ${SOURCE}/README.md* ${TARGET}/README.md | ||
cp -vr ${SOURCE}/LICENSE ${TARGET}/LICENSE |