84 lines
2.7 KiB
YAML
84 lines
2.7 KiB
YAML
on:
|
|
schedule:
|
|
- cron: '0 * * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Send ntfy notification (Run Started)
|
|
run: |
|
|
curl \
|
|
-u ${{ secrets.NTFY_AUTH }} \
|
|
-H "Title: LanCache AGH conf generation started" \
|
|
-H "Priority: 5" \
|
|
-d "Generating AdguardHome config for Lancache" \
|
|
https://ntfy.uzurka.fr/lancache
|
|
|
|
- name: Setup SSH
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh-keyscan -H git.ssh.uzurka.fr >> ~/.ssh/known_hosts
|
|
|
|
- name: Generate lancache.conf
|
|
run: |
|
|
git clone https://github.com/uklans/cache-domains.git
|
|
cd cache-domains
|
|
cat <<EOF > scripts/config.json
|
|
{
|
|
"combined_output": true,
|
|
"ips": {
|
|
"monolithic": ["10.0.1.20"]
|
|
},
|
|
"cache_domains": {
|
|
"blizzard": "monolithic",
|
|
"epicgames": "monolithic",
|
|
"nintendo": "monolithic",
|
|
"origin": "monolithic",
|
|
"riot": "monolithic",
|
|
"sony": "monolithic",
|
|
"steam": "monolithic",
|
|
"uplay": "monolithic",
|
|
"wsus": "monolithic"
|
|
}
|
|
}
|
|
EOF
|
|
cd scripts
|
|
bash create-adguardhome.sh
|
|
cp output/adguardhome/lancache.conf /tmp/lancache.conf
|
|
sed -i "1i# $(date +%d-%m-%Y %H) - Generated with Gitea Actions" /tmp/lancache.conf
|
|
|
|
- name: upload it on my repo
|
|
run: |
|
|
git config --global user.name "Gitea Actions"
|
|
git config --global user.email "me@uzurka.fr"
|
|
git clone git@git.ssh.uzurka.fr:Uzurka/lancache-adguardhome-config.git
|
|
cd lancache-adguardhome-config
|
|
cp /tmp/lancache.conf ./
|
|
git add lancache.conf
|
|
git commit -m "Update AGH Conf on $(date +'%Y-%m-%d %H')"
|
|
git push
|
|
|
|
- name: Send ntfy notification (Success)
|
|
if: success()
|
|
run: |
|
|
curl \
|
|
-u ${{ secrets.NTFY_AUTH }} \
|
|
-H "LanCache AGH conf generation succeed" \
|
|
-H "Priority: 5" \
|
|
-d "LanCache AGH conf generation succeed" \
|
|
https://ntfy.uzurka.fr/lancache
|
|
|
|
- name: Send ntfy notification (Failure)
|
|
if: failure()
|
|
run: |
|
|
curl \
|
|
-u ${{ secrets.NTFY_AUTH }} \
|
|
-H "LanCache AGH conf generation failed" \
|
|
-H "Priority: 5" \
|
|
-d "LanCache AGH conf generation failed" \
|
|
https://ntfy.uzurka.fr/lancache
|