-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (77 loc) · 2.42 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
name: docker
on:
pull_request:
branches:
- main
paths:
- "Dockerfile"
- "docker-compose.yml"
- ".dockerignore"
- ".github/workflows/docker.yml"
- "acceptance/Dockerfile"
- "acceptance/docker-compose.acceptance.yml"
- "acceptance/ssh_server/Dockerfile"
- ".crystal-version"
- "shard.yml"
- "shard.lock"
push:
branches:
- main
tags:
- "v*.*.*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
attestations: write
id-token: write
jobs:
docker:
name: docker
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: extract image metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # [email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern=v{{version}}
type=sha
- name: set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # pin@v3
- name: set up docker buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # [email protected]
- name: login to ghcr
if: github.event_name != 'pull_request'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # [email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and push
id: push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # [email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: digest
env:
DIGEST: ${{ steps.push.outputs.digest }}
run: |
echo "digest: $DIGEST"
# - name: generate artifact attestation
# uses: actions/[email protected]
# with:
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: ${{ github.event_name != 'pull_request' }}