2727 uv build
2828 uv publish
2929
30- push_to_docker_hub :
31- name : Push Docker image to Docker Hub
30+ build_and_test_docker_amd64 :
31+ name : Build and test Docker image (AMD64)
3232 runs-on : ubuntu-latest
33+ permissions :
34+ contents : read
35+ packages : write
36+ steps :
37+ - name : Check out the repo
38+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39+
40+ - name : Log in to GitHub Container Registry
41+ uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
42+ with :
43+ registry : ghcr.io
44+ username : ${{ github.actor }}
45+ password : ${{ secrets.GITHUB_TOKEN }}
46+
47+ - name : Build Docker image (AMD64)
48+ uses : ./.github/actions/docker-build
49+ with :
50+ push : " false"
51+ platforms : linux/amd64
52+ dockerfile : ./Dockerfile
53+ context : .
54+ image-name : elementsinteractive/twyn
55+ cache-from : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache-amd64
56+ cache-to : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache-amd64,mode=max,compression=zstd,force-compression=true,oci-mediatypes=true
57+
58+ - name : Test Docker image (AMD64)
59+ run : |
60+ docker run --platform linux/amd64 --rm elementsinteractive/twyn:test-amd64 --version
61+
62+ build_and_test_docker_arm64 :
63+ name : Build and test Docker image (ARM64)
64+ runs-on : ubuntu-latest
65+ permissions :
66+ contents : read
67+ packages : write
68+ steps :
69+ - name : Check out the repo
70+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
71+
72+ - name : Log in to GitHub Container Registry
73+ uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
74+ with :
75+ registry : ghcr.io
76+ username : ${{ github.actor }}
77+ password : ${{ secrets.GITHUB_TOKEN }}
78+
79+ - name : Build Docker image (ARM64)
80+ uses : ./.github/actions/docker-build
81+ with :
82+ push : " false"
83+ platforms : linux/arm64
84+ dockerfile : ./Dockerfile
85+ context : .
86+ image-name : elementsinteractive/twyn
87+ cache-from : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache-arm64
88+ cache-to : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache-arm64,mode=max,compression=zstd,force-compression=true,oci-mediatypes=true
89+
90+ - name : Set up QEMU
91+ uses : docker/setup-qemu-action@v3
92+ with :
93+ platforms : arm64
94+
95+ - name : Test Docker image (ARM64)
96+ run : |
97+ docker run --platform linux/arm64 --rm elementsinteractive/twyn:test-arm64 --version
98+
99+ publish_docker_images :
100+ name : Push Docker images to registries
101+ runs-on : ubuntu-latest
102+ needs : [build_and_test_docker_amd64, build_and_test_docker_arm64]
33103 permissions :
34104 contents : read
35105 packages : write
@@ -50,16 +120,25 @@ jobs:
50120 username : ${{ github.actor }}
51121 password : ${{ secrets.GITHUB_TOKEN }}
52122
53- - name : Build and push Docker image
123+ - name : Push Docker image (AMD64)
54124 uses : ./.github/actions/docker-build
55125 with :
56- push-image : " true"
57- platforms : linux/amd64,linux/arm64
126+ push : " true"
127+ platforms : linux/amd64
58128 dockerfile : ./Dockerfile
59129 context : .
60130 image-name : elementsinteractive/twyn
61- cache-from : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache
62- cache-to : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache,mode=max,compression=zstd,force-compression=true,oci-mediatypes=true
131+ cache-from : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache-amd64
132+
133+ - name : Push Docker image (ARM64)
134+ uses : ./.github/actions/docker-build
135+ with :
136+ push : " true"
137+ platforms : linux/arm64
138+ dockerfile : ./Dockerfile
139+ context : .
140+ image-name : elementsinteractive/twyn
141+ cache-from : type=registry,ref=ghcr.io/elementsinteractive/twyn:buildcache-arm64
63142
64143 - name : Delete old cache entries
65144 env :
@@ -68,17 +147,18 @@ jobs:
68147 # Get all versions of the container package
69148 versions=$(gh api "orgs/elementsinteractive/packages/container/twyn/versions" --paginate)
70149
71- # Extract version IDs that do NOT have the ' buildcache' tag
72- ids_to_delete=$(echo "$versions" | jq -r '.[] | select(.metadata.container.tags | index(" buildcache") | not) | .id')
150+ # Extract version IDs that do NOT have any buildcache-* tags (buildcache-amd64, buildcache-arm64, etc.)
151+ ids_to_delete=$(echo "$versions" | jq -r '.[] | select(.metadata.container.tags | map(test("^ buildcache-")) | any | not) | .id')
73152
74153 # Delete them
75154 for id in $ids_to_delete; do
76155 echo "Deleting old cache version ID: $id"
77156 gh api -X DELETE "orgs/elementsinteractive/packages/container/twyn/versions/$id"
78157 done
158+
79159 release_notes :
80160 runs-on : ubuntu-latest
81- needs : [push_to_pypi, push_to_docker_hub ]
161+ needs : [push_to_pypi, publish_docker_images ]
82162 steps :
83163 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
84164 - name : Release
0 commit comments