-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (103 loc) · 4.07 KB
/
ci.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
105
106
107
108
109
110
111
112
113
114
115
116
117
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
packages: write
jobs:
test-single-format:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Test Image
working-directory: test
env:
BUILD_IDENTIFIER: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_id }}
run: podman build -t push-to-registry-action-ci:local --build-arg=BUILD_IDENTIFIER=${BUILD_IDENTIFIER} .
- name: Push (Single)
uses: ./
id: push
with:
image: push-to-registry-action-ci
manifest-tags: ${{ github.sha }}-${{ github.run_number }} ${{ github.sha }}-${{ github.run_number }}-single
registry: ghcr.io/${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Read Outputs
run: |
echo "Digest: ${{ steps.push.outputs.digest }}"
echo "Registry Path": ${{ steps.push.outputs.registry-path }}
- name: Inspect Image Manifest
env:
MANIFEST_TAG: ${{ github.sha }}-${{ github.run_number }}
REGISTRY: ghcr.io/${{ github.repository }}
IMAGE: push-to-registry-action-ci
DIGEST: ${{ steps.push.outputs.digest }}
run: |
MANIFEST=$(skopeo inspect docker://${REGISTRY}/${IMAGE}:${MANIFEST_TAG} | jq .)
echo "Manifest: $MANIFEST"
if [[ $(echo $MANIFEST | jq -r .Digest) != $DIGEST ]]; then
echo "Digest mismatch - expected $DIGEST, got $(echo $MANIFEST | jq -r .Digest)"
exit 1
fi
- name: Inspect Image Raw Manifest
env:
MANIFEST_TAG: ${{ github.sha }}-${{ github.run_number }}
REGISTRY: ghcr.io/${{ github.repository }}
IMAGE: push-to-registry-action-ci
DIGEST: ${{ steps.push.outputs.digest }}
run: |
RAW_MANIFEST=$(skopeo inspect --raw docker://${REGISTRY}/${IMAGE}:${MANIFEST_TAG} | jq -r .)
echo "Raw Manifest: $RAW_MANIFEST"
test-multi-format:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Test Image
working-directory: test
env:
BUILD_IDENTIFIER: ${{ github.sha }}-${{ github.run_number }}-${{ github.run_id }}
run: podman build -t push-to-registry-action-ci:local --build-arg=BUILD_IDENTIFIER=${BUILD_IDENTIFIER} .
- name: Push (Multiple)
uses: ./
id: push
with:
image: push-to-registry-action-ci
manifest-tags: ${{ github.sha }}-${{ github.run_number }} ${{ github.sha }}-${{ github.run_number }}-multi
registry: ghcr.io/${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
compression-formats: gzip zstd:chunked
- name: Read Outputs
run: |
echo "Digest: ${{ steps.push.outputs.digest }}"
echo "Registry Path: ${{ steps.push.outputs.registry-path }}"
- name: Inspect Image Manifest
env:
MANIFEST_TAG: ${{ github.sha }}-${{ github.run_number }}
REGISTRY: ghcr.io/${{ github.repository }}
IMAGE: push-to-registry-action-ci
DIGEST: ${{ steps.push.outputs.digest }}
run: |
MANIFEST=$(skopeo inspect docker://${REGISTRY}/${IMAGE}:${MANIFEST_TAG} | jq .)
echo "Manifest: $MANIFEST"
if [[ $(echo $MANIFEST | jq -r .Digest) != $DIGEST ]]; then
echo "Digest mismatch - expected $DIGEST, got $(echo $MANIFEST | jq -r .Digest)"
exit 1
fi
- name: Inspect Image Raw Manifest
env:
MANIFEST_TAG: ${{ github.sha }}-${{ github.run_number }}
REGISTRY: ghcr.io/${{ github.repository }}
IMAGE: push-to-registry-action-ci
DIGEST: ${{ steps.push.outputs.digest }}
run: |
RAW_MANIFEST=$(skopeo inspect --raw docker://${REGISTRY}/${IMAGE}:${MANIFEST_TAG} | jq -r .)
echo "Raw Manifest: $RAW_MANIFEST"