Update IP list #787
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 IP list | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 1 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ !startsWith(github.event.head_commit.message, 'Update IP list') }} | |
env: | |
ORGANIZATION_NAME: growlfm | |
REPOSITORY: ipcat | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.DEVOPS_GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Ensure cache directory exists | |
run: mkdir -p /tmp/.buildx-cache | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build | |
run: | | |
docker compose build | |
- name: Update | |
run: | | |
docker compose run update | |
- name: Copy artifacts | |
run: | | |
cp ${{ github.workspace }}/tmp/ipcat/* ${{ github.workspace }} | |
- name: Check for diffs | |
id: check_changes | |
run: | | |
if [ -n "$(git diff --name-only ./datacenters.csv ./datacenters-stats.csv)" ]; then | |
echo "diffs=true" >> $GITHUB_OUTPUT | |
else | |
echo "diffs=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit updated IP list artifacts | |
if: ${{ steps.check_changes.outputs.diffs == 'true' }} | |
run: | | |
git config --global user.name "Growl Dev-Ops" | |
git config --global user.email "[email protected]" | |
git add ./datacenters.csv ./datacenters-stats.csv | |
git commit -m "Update IP list" | |
git push | |
- name: Save Docker layers cache | |
if: always() | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |