Skip to content

Commit

Permalink
Add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
whitfiea committed Apr 24, 2024
1 parent d6b9231 commit 6648659
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/update-internal-repo.yaml
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##*/}
41 changes: 41 additions & 0 deletions build/bin/copy-gitops.sh
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

0 comments on commit 6648659

Please sign in to comment.