Update EasyDutch CDN #2043
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: Update EasyDutch CDN | |
on: | |
schedule: | |
- cron: "15 */2 * * 1-6" | |
workflow_dispatch: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
publish: | |
name: Update EasyDutch CDN | |
runs-on: ubuntu-latest | |
steps: | |
- name: Repo check | |
run: | | |
if [[ "$GITHUB_REPOSITORY_OWNER" != "EasyDutch-uBO" ]]; then | |
echo "This GitHub Action is meant to deliver filter lists for EasyDutch." | |
echo "You shouldn't need to run this GitHub Action in your fork." | |
echo "If you do, please customize the cron expression above, and the URLs below." | |
exit 1 | |
fi | |
exit 0 | |
- name: Clone EasyDutchCDN | |
uses: actions/checkout@v3 | |
- name: Copy EasyDutch filters to EasyDutchCDN | |
run: | | |
TMPFILE=$(mktemp -d) | |
git clone --depth=1 --single-branch --branch=gh-pages https://github.com/EasyDutch-uBO/EasyDutch.git $TMPFILE | |
cp $TMPFILE/EasyDutch/*.txt EasyDutch/ | |
cp $TMPFILE/EasyDutch.txt EasyDutch.txt | |
cp $TMPFILE/EasyDutch.all.txt EasyDutch.all.txt | |
- name: Commit changes (if any) | |
run: | | |
if [[ -n $(git diff) ]]; then | |
git config user.name "GitHub Actions" | |
git config user.email "<>" | |
git add -u EasyDutch/ EasyDutch.txt EasyDutch.all.txt | |
git commit -m "Update all CDN assets" | |
git push origin main | |
fi |