Skip to content

Commit

Permalink
Update test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jlubken committed Aug 31, 2022
1 parent 3fc492b commit b2ae495
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ jobs:
run: |
./scripts/cruft.sh \
--branch ${{ github.ref_name }} \
--name ${GITHUB_REPOSITORY#*/} \
--organization ${GITHUB_REPOSITORY%/*} \
--repository ${{ github.repository }} \
--username ${{ secrets.username }}
- name: push
if: ${GITHUB_REPOSITORY%/*} == "servicetemplate"
if: ${{ github.repository }} == "pennsignals/servicetemplate"
run: |
./scripts/push.sh \
--branch ${{ github.ref_name }} \
--name ${GITHUB_REPOSITORY#*/} \
--organization ${GITHUB_REPOSITORY%/*} \
--password ${{ secrets.pat }}
--repository ${{ github.repository }} \
--username ${{ secrets.username }} \
17 changes: 11 additions & 6 deletions scripts/cruft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ while [ $# -gt 0 ]; do
;;
-h|--host)
host="$2"
;;
-n|--name)
name="$2"
;;
-o|--organization)
organization="$2"
-r|--repository)
repository="$2"
;;
-u|--username)
username="$2"
;;
*)
echo "Invalid argument: $1"
echo "Expected: --branch --canary --host --name --organization --username"
echo "Required:"
echo " --repository organization/project"
echo " --username"
echo "Optional:"
echo " --branch main"
echo " --canary projectcanary"
echo " --host github.com"
exit 1
esac
shift
Expand All @@ -32,6 +35,8 @@ done

branch=${branch:-"main"}
host=${host:-"github.com"}
name=${repository#*/}
organization=${repository%/*}

canary=${canary:-"${name}canary"}

Expand Down
15 changes: 12 additions & 3 deletions scripts/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ while [ $# -gt 0 ]; do
-h|--host)
host="$2"
;;
-n|--name)
-r|--repository)
name="$2"
;;
-p|--password)
Expand All @@ -23,7 +23,14 @@ while [ $# -gt 0 ]; do
;;
*)
echo "Invalid argument: $1"
echo "Expected: --branch --canary --host --name --password --username"
echo "Required:"
echo " --password"
echo " --repository organization/project"
echo " --username"
echo "Optional:"
echo " --branch main"
echo " --canary projectcanary"
echo " --host github.com"
exit 1
esac
shift
Expand All @@ -32,10 +39,12 @@ done

branch=${branch:-"main"}
host=${host:-"github.com"}
name=${repository#*/}
organization=${repository%/*}

canary=${canary:-"${name}canary"}

cd "${canary}"
git config credential.helper store
(echo "protocol=https"; echo "host=${host}"; echo "username=${username}"; echo password=$(printf "${password}" | jq -sRr @uri); echo) | git credential approve
git push -u origin "${branch}" --force-with-lease -v
git push -u origin "${branch}" --force --verbose

0 comments on commit b2ae495

Please sign in to comment.