-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (76 loc) · 2.52 KB
/
docker-build.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
88
name: Docker Build
on:
workflow_dispatch:
schedule:
- cron: "0 10 * * *" # Run every day at 10:00 UTC for nightly tag
push:
tags:
- 'v**'
jobs:
docker:
name: Build and Push Docker Image
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
id-token: write
attestations: write
env:
IMAGE_NAME: ghcr.io/mountaingod2/chaturbate_poller
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Generate Docker Build Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/mountaingod2/chaturbate_poller
docker.io/mountaingod2/chaturbate_poller
tags: |
type=schedule,pattern=nightly
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Export Test Image
uses: docker/build-push-action@v6
with:
load: true
tags: mountaingod2/chaturbate_poller:test
- name: Test Docker Image
run: |
docker run --rm mountaingod2/chaturbate_poller:test --help
- name: Build and Push Docker Image
id: push
uses: docker/build-push-action@v6
with:
push: true
sbom: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}-cache,mode=max
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}-cache
- name: Attest Build Provenance
uses: actions/attest-build-provenance@v2
id: attest
with:
subject-name: ghcr.io/mountaingod2/chaturbate_poller
subject-digest: ${{ steps.push.outputs.digest }}