forked from client9/ipcat
-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (62 loc) · 1.92 KB
/
update-ip-list.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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 }}