-
Notifications
You must be signed in to change notification settings - Fork 2
117 lines (93 loc) · 3.12 KB
/
Copy pathpublish-image.yaml
File metadata and controls
117 lines (93 loc) · 3.12 KB
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: Publish Docker image
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
id-token: write
concurrency:
group: publish-image-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE: public.ecr.aws/q3z6g1h3/idcat
jobs:
version:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.image-version.outputs.tag }}
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Install python
run: uv venv && uv pip install bktools --extra-index-url https://repo.noa.re
- name: Compute Docker image tag
id: image-version
run: |
image_version="$(uv run bktools-image-version-hash)"
echo "tag=${image_version}" >> "$GITHUB_OUTPUT"
build:
strategy:
matrix:
include:
- platform: linux/amd64
runner: ubuntu-24.04
output_name: digest_amd64
- platform: linux/arm64
runner: ubuntu-24.04-arm
output_name: digest_arm64
runs-on: ${{ matrix.runner }}
outputs:
digest_amd64: ${{ steps.export.outputs.digest_amd64 }}
digest_arm64: ${{ steps.export.outputs.digest_arm64 }}
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::436027055282:role/product-roles/idcat-ecr-publish
aws-region: us-east-1
- name: Log in to Amazon ECR Public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push image by digest
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true,compression=zstd,force-compression=true
- name: Export digest
id: export
run: |
echo "${{ matrix.output_name }}=${{ steps.build.outputs.digest }}" >> "$GITHUB_OUTPUT"
merge:
needs: [version, build]
runs-on: ubuntu-24.04
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::436027055282:role/product-roles/idcat-ecr-publish
aws-region: us-east-1
- name: Log in to Amazon ECR Public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Create and push manifest list
run: |
docker buildx imagetools create \
-t "${IMAGE}:${{ needs.version.outputs.tag }}" \
"${IMAGE}@${{ needs.build.outputs.digest_amd64 }}" \
"${IMAGE}@${{ needs.build.outputs.digest_arm64 }}"