-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* ci(submodule): push update to parent submodule * Use remote branch with check * tmp: use fork * fix variables * point git config to gitmodules * move to own workflow, update rev-parse * don't use fork (cherry picked from commit 940b9d2) Co-authored-by: Elliott Baron <ebaron@redhat.com>
- Loading branch information
1 parent
c91e7d5
commit fc576a2
Showing
1 changed file
with
44 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,44 @@ | ||
name: submodule | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- v[0-9]+ | ||
- v[0-9]+.[0-9]+ | ||
- cryostat-v[0-9]+.[0-9]+ | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
update-submodule: | ||
if: ${{ github.repository_owner == 'cryostatio' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: cryostatio/cryostat | ||
token: "${{ secrets.SUBMODULE_TOKEN }}" | ||
ref: "${{ github.ref_name }}" | ||
- name: Check remote submodule branch | ||
run: | | ||
remote_branch="$(git config --get -f .gitmodules submodule.web-client.branch)" | ||
if [[ "$remote_branch" != "${{ github.ref_name }}" ]]; then | ||
printf "Expected remote branch %s, found branch %s\n" "${{ github.ref_name }}" "$remote_branch" >&2 | ||
exit 1 | ||
fi | ||
- name: Update submodule to latest commit | ||
run: | | ||
git submodule update --init | ||
git submodule update --remote | ||
- name: Commit and push submodule | ||
# User info comes from: https://github.saobby.my.eu.orgmunity/t/github-actions-bot-email-address/17204/5 | ||
run: | | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config user.name "github-actions[bot]" | ||
git add --all | ||
git_hash="$(git rev-parse --short :web-client)" | ||
git commit -m "build(web-client): update submodule to $git_hash" || echo "No changes to commit" | ||
git push |