Rebuild Manifests #212
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
name: Rebuild Manifests | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone profilecreator-schemas repository | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
path: main | |
- name: Clone ProfileManifests repository | |
uses: actions/checkout@v2 | |
with: | |
ref: master | |
repository: ProfileCreator/ProfileManifests | |
path: ProfileManifests | |
- name: Regenerate manifests and commit changes | |
working-directory: main | |
run: | | |
PREV=$(cat last_build.json | jq -r .hash) | |
# TODO: Why doesn't this work? | |
# HASH=$(git show-ref refs/heads/master --hash) | |
HASH=$(cat $GITHUB_WORKSPACE/ProfileManifests/.git/refs/heads/master) | |
[[ $PREV == $HASH ]] && exit 0 | |
DATE=$(date -u "+%Y-%m-%d %H:%M:%S") | |
echo "{ \"hash\": \"$HASH\", \"date\": \"$DATE\" }" > last_build.json | |
/usr/bin/python3 ./build.py $GITHUB_WORKSPACE/ProfileManifests/Manifests --output-dir ./manifests --overwrite --verbose | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add -A | |
git commit -anm "Regenerate manifests" -m "Upstream diff: https://github.com/ProfileCreator/ProfileManifests/compare/$PREV..$HASH" || true | |
git push --set-upstream origin main || true |