-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.25 KB
/
cron_package.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
name: Package latest
on:
push:
schedule:
- cron: '0 * * * *'
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: true
matrix:
arch: ["amd64"]
include:
- arch: amd64
os: ubuntu-latest
steps:
- name: Set environment variables
id: env
run: |
eval "$(curl -sL --request GET \
--url "https://api.github.com/repos/Jackett/Jackett/releases" \
--header "Accept: application/vnd.github+json" \
--header "Authorization: token ${{ github.token }}" \
| jq -r '.[0] | "export TAG=\(.tag_name)"')"
echo "VERSION=${TAG//v}" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Sanitize repo slug
uses: actions/github-script@v7
id: repo_slug
with:
result-encoding: string
script: return '${{ github.repository }}'.toLowerCase()
- name: Check if image exists
uses: tyriis/[email protected]
id: image_exists
with:
registry: ghcr.io
repository: ${{ steps.repo_slug.outputs.result }}
tag: ${{ steps.env.outputs.VERSION }}
- uses: actions/checkout@v4
if: ${{ steps.image_exists.outputs.tag == 'not found' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: ${{ steps.image_exists.outputs.tag == 'not found' }}
- name: Build and push
uses: docker/build-push-action@v5
if: ${{ steps.image_exists.outputs.tag == 'not found' }}
with:
build-args: |
VERSION=${{ steps.env.outputs.VERSION }}
context: .
platforms: linux/${{ matrix.arch }}
push: true
tags: |
ghcr.io/${{ steps.repo_slug.outputs.result }}:${{ steps.env.outputs.VERSION }}
ghcr.io/${{ steps.repo_slug.outputs.result }}:latest
- name: ghcr.io Cleanup Action
uses: dataaxiom/[email protected]
if: ${{ steps.image_exists.outputs.tag != 'found' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}