-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (79 loc) · 2.22 KB
/
worker.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
on:
workflow_dispatch:
schedule:
- cron: '13 */6 * * *'
name: worker
env:
REGISTRY: ghcr.io
IMAGE_NAME: flexicon/tft-suggester/worker
jobs:
build_image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@5138f76647652447004da686b2411557eaf65f33
name: Setup buildx
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
scrape_champions:
uses: ./.github/workflows/run_scraper.yml
needs: build_image
secrets: inherit
with:
scraper: scrape_champions
image_name: ghcr.io/flexicon/tft-suggester/worker
scrape_comps:
uses: ./.github/workflows/run_scraper.yml
needs: build_image
secrets: inherit
with:
scraper: scrape_comps
image_name: ghcr.io/flexicon/tft-suggester/worker
scrape_items:
uses: ./.github/workflows/run_scraper.yml
needs: build_image
secrets: inherit
with:
scraper: scrape_items
image_name: ghcr.io/flexicon/tft-suggester/worker
trigger_webhook:
runs-on: ubuntu-latest
needs:
- scrape_champions
- scrape_comps
- scrape_items
steps:
- name: curl
run: |
curl -X POST ${{ secrets.DATA_FETCHED_WEBHOOK }}
cleanup:
runs-on: ubuntu-latest
needs:
- scrape_champions
- scrape_comps
- scrape_items
steps:
- uses: actions/delete-package-versions@0635864898b476b1b4ba530fc7854286f20b360c
with:
package-name: 'tft-suggester/worker'
package-type: 'container'
min-versions-to-keep: 5
delete-only-untagged-versions: 'true'