Ensure buildstrap is up-to-date #79
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: CI | |
on: | |
# Compare the preceeding commit of main -> to the current commit of the main branch. | |
# (Note: To compare changes between the last pushed commit to the remote main branch set `since_last_remote_commit: true`) | |
push: | |
branches: | |
- main | |
# Compare the last commit of main -> to the current commit of a PR branch. | |
# (Note: To compare changes between the last pushed commit to the remote PR branch set `since_last_remote_commit: true`) | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest # windows-latest | macos-latest | |
name: Generate spec files | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Generate specs and commit to spec branch | |
run: | | |
set -x | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
# switch to specs, create if doesn't exist | |
git fetch | |
git checkout specs 2>/dev/null || git checkout -b specs || exit 1 | |
# check out files built from main to specs (mirror) | |
git checkout main build | |
# ensures jinja2 is accessible | |
pip install jinja2-cli[yaml] | |
for f in build/*.xml; do | |
name=$(basename $f .xml) | |
if diff "$f" "${name}.xml" >/dev/null; then | |
VERSION=$(date --utc +%Y%m%d) | |
/bin/cp -f $f ./ | |
jinja2 src/ipset.spec.j2 "build/${name}.yml" -D version=${VERSION} --outfile=firewalld-ipset-${name}.spec | |
fi | |
done | |
git add *.spec *.xml | |
git commit -m "Up" | |
# push branches | |
git push origin specs | |
cat firewalld-ipset-braintree.spec |