-
Notifications
You must be signed in to change notification settings - Fork 6
104 lines (93 loc) · 2.87 KB
/
docker.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Docker
on:
push:
branches:
- '**'
tags:
- 'v*'
paths:
- 'go.sum'
- 'go.mod'
- '**.go'
- .github/workflows/docker.yml
- dist.Dockerfile
pull_request:
branches:
- main
paths:
- '**.go'
- 'go.sum'
- 'go.mod'
- dist.Dockerfile
- .github/workflows/docker.yml
permissions:
actions: write
packages: write
id-token: write
attestations: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Docker:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
username: cyb3rjak3
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: cyb3rjak3/cloudflare-utils,ghcr.io/cyb3r-jak3/cloudflare-utils
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
path: cloudflare-utils
- name: Build
uses: docker/build-push-action@v6
id: build
with:
context: cloudflare-utils
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6, linux/386, linux/riscv64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: cloudflare-utils/dist.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
sbom: true
provenance: mode=max
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v4
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
username: cyb3rjak3
password: ${{ secrets.DOCKER_PASSWORD }}
repository: cyb3rjak3/cloudflare-utils
readme-filepath: cloudflare-utils/README.md
- name: GitHub Container Attestation
uses: actions/attest-build-provenance@v2
id: attest
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
subject-name: ghcr.io/cyb3r-jak3/cloudflare-utils
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true