Upgrade Font Awesome library #495
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: Upgrade Font Awesome library | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "57 2 * * *" | |
env: | |
LIBRARY: font-awesome | |
INPUT_FILE: input-for-cookiecutter.txt | |
STATIC_FILE: js/all.min.js | |
jobs: | |
upgrade-library: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git for commits | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
- name: Get the latest library version | |
run: |- | |
VERSION=$(curl -s https://api.cdnjs.com/libraries/$LIBRARY?fields=version | jq -r .version) | |
echo $VERSION >> $INPUT_FILE | |
echo 'VERSION='$VERSION >> $GITHUB_ENV | |
- name: Download the latest static file | |
run: |- | |
curl -s https://cdnjs.cloudflare.com/ajax/libs/$LIBRARY/$VERSION/$STATIC_FILE -o src/flask_font_awesome/static/$STATIC_FILE | |
- name: Get CSS and JS SRI maps | |
run: |- | |
SRI=$(curl -s https://api.cdnjs.com/libraries/$LIBRARY/$VERSION?fields=sri) | |
echo $SRI | jq --compact-output '{"all": .sri."css/all.min.css", "regular": .sri."css/regular.min.css", "solid": .sri."css/solid.min.css", "brands": .sri."css/brands.min.css", "fontawesome": .sri."css/fontawesome.min.css"}' >> $INPUT_FILE | |
echo $SRI | jq --compact-output '{"all": .sri."js/all.min.js", "regular": .sri."js/regular.min.js", "solid": .sri."js/solid.min.js", "brands": .sri."js/brands.min.js", "fontawesome": .sri."js/fontawesome.min.js"}' >> $INPUT_FILE | |
- name: Build source code | |
run: | | |
cat $INPUT_FILE | |
cat $INPUT_FILE | pipx run cookiecutter --overwrite-if-exists template | |
- name: Run pre-commit hooks | |
run: | | |
pipx run pre-commit run --files src/**/* | |
continue-on-error: true | |
- name: Commit and push if there are any changes | |
run: |- | |
git add src | |
if ! git diff --cached --quiet src; then | |
git commit -m ":arrow_up: Upgrade Font Awesome to version $VERSION" | |
git push | |
fi |