Skip to content

Build and deploy

Build and deploy #5

Workflow file for this run

name: Build and deploy
run-name: Build and deploy
on:
workflow_dispatch:
schedule:
- cron: '0 23 * * *'
permissions:
contents: write
jobs:
test-functions:
uses: ./.github/workflows/test_functions.yml
update-toplist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Update toplist
run: |
wget -qO - 'https://tranco-list.eu/top-1m.csv.zip' | gunzip - > toplist.tmp
awk -F ',' '{print $2}' toplist.tmp > data/toplist.txt
bash functions/tools.sh format data/toplist.txt
rm toplist.tmp
- name: Push
run: |
git config user.email ${{ vars.GIT_EMAIL }}
git config user.name ${{ vars.GIT_USERNAME }}
git add .
git diff-index --quiet HEAD || git commit -m "Update toplist"
git push -q
build:
needs: [test-functions, update-toplist]
uses: ./.github/workflows/retrieve_domains.yml
secrets: inherit
remove-dead:
needs: [test-functions, build]
if: ${{ ! cancelled() && needs.test-functions.result == 'success' }}
uses: ./.github/workflows/check_dead.yml
validate:
needs: [test-functions, remove-dead]
if: ${{ ! cancelled() && needs.test-functions.result == 'success' }}
uses: ./.github/workflows/validate_entries.yml
deploy:
needs: [test-functions, validate]
if: ${{ ! cancelled() && needs.test-functions.result == 'success' }}
uses: ./.github/workflows/build_lists.yml
prune-logs:
needs: deploy
if: ${{ ! cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Prune logs
run: |
lines="$(wc -l < config/domain_log.csv)"
if (( lines > 10000 )); then
sed -i "1,$(( lines - 10000 ))d" config/domain_log.csv
fi
lines="$(wc -l < config/source_log.csv)"
if (( lines > 1000 )); then
sed -i "1,$(( lines - 1000 ))d" config/source_log.csv
fi
- name: Push
run: |
git config user.email ${{ vars.GIT_EMAIL }}
git config user.name ${{ vars.GIT_USERNAME }}
git add .
git diff-index --quiet HEAD || git commit -m "Prune logs"
git push -q
update-readme:
needs: [deploy, prune-logs]
if: ${{ ! cancelled() && needs.deploy.result == 'success' }}
uses: ./.github/workflows/update_readme.yml