Skip to content

Commit 2c98493

Browse files
ci: public arm64 docker image (#850)
1 parent 0419933 commit 2c98493

File tree

1 file changed

+70
-8
lines changed

1 file changed

+70
-8
lines changed

.github/workflows/publish.yml

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
name: Publish
1+
name: Build and Validate
22
on:
33
push:
44
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
58
jobs:
6-
publish:
7-
runs-on: ubuntu-latest
9+
build:
10+
strategy:
11+
matrix:
12+
arch: [amd64, arm64]
13+
include:
14+
- arch: amd64
15+
platform: linux/amd64
16+
runner: ubuntu-latest
17+
- arch: arm64
18+
platform: linux/arm64
19+
runner: arm-hooray
20+
runs-on: ${{ matrix.runner }}
821
permissions:
922
contents: read
1023
id-token: write
@@ -25,27 +38,76 @@ jobs:
2538
username: ${{ github.actor }}
2639
password: ${{ secrets.GITHUB_TOKEN }}
2740

41+
# Set the Docker tags based on the event type
42+
- name: Set Docker tags
43+
id: docker-tags
44+
run: |
45+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
46+
echo "HYPERION_PROXY_TAGS=ghcr.io/${{ github.repository }}/hyperion-proxy:pr-${{ github.event.pull_request.number }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT
47+
echo "TAG_TAGS=ghcr.io/${{ github.repository }}/tag:pr-${{ github.event.pull_request.number }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT
48+
else
49+
echo "HYPERION_PROXY_TAGS=ghcr.io/${{ github.repository }}/hyperion-proxy:latest-${{ matrix.arch }},ghcr.io/${{ github.repository }}/hyperion-proxy:${{ github.sha }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT
50+
echo "TAG_TAGS=ghcr.io/${{ github.repository }}/tag:latest-${{ matrix.arch }},ghcr.io/${{ github.repository }}/tag:${{ github.sha }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT
51+
fi
52+
2853
- name: Build and push hyperion-proxy
2954
uses: docker/build-push-action@v5
3055
with:
3156
context: .
3257
target: hyperion-proxy
33-
platforms: linux/amd64
58+
platforms: ${{ matrix.platform }}
3459
push: true
35-
tags: |
36-
ghcr.io/${{ github.repository }}/hyperion-proxy:latest
37-
ghcr.io/${{ github.repository }}/hyperion-proxy:${{ github.sha }}
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max
62+
tags: ${{ steps.docker-tags.outputs.HYPERION_PROXY_TAGS }}
3863

3964
- name: Build and push tag
4065
uses: docker/build-push-action@v5
4166
with:
4267
context: .
4368
target: tag
44-
platforms: linux/amd64
69+
platforms: ${{ matrix.platform }}
70+
push: true
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max
73+
tags: ${{ steps.docker-tags.outputs.TAG_TAGS }}
74+
75+
manifest:
76+
needs: build
77+
# Only run manifest job on pushes to main
78+
if: github.event_name == 'push'
79+
runs-on: ubuntu-latest
80+
permissions:
81+
contents: read
82+
id-token: write
83+
packages: write
84+
steps:
85+
- name: Log in to GitHub Container Registry
86+
uses: docker/login-action@v3
87+
with:
88+
registry: ghcr.io
89+
username: ${{ github.actor }}
90+
password: ${{ secrets.GITHUB_TOKEN }}
91+
92+
- name: Create and push manifest for hyperion-proxy
93+
uses: docker/build-push-action@v5
94+
with:
95+
push: true
96+
platforms: linux/amd64,linux/arm64
97+
tags: |
98+
ghcr.io/${{ github.repository }}/hyperion-proxy:latest
99+
ghcr.io/${{ github.repository }}/hyperion-proxy:${{ github.sha }}
100+
outputs: type=image,name=ghcr.io/${{ github.repository }}/hyperion-proxy
101+
102+
- name: Create and push manifest for tag
103+
uses: docker/build-push-action@v5
104+
with:
45105
push: true
106+
platforms: linux/amd64,linux/arm64
46107
tags: |
47108
ghcr.io/${{ github.repository }}/tag:latest
48109
ghcr.io/${{ github.repository }}/tag:${{ github.sha }}
110+
outputs: type=image,name=ghcr.io/${{ github.repository }}/tag
49111

50112
- name: Update test server
51113
env:

0 commit comments

Comments
 (0)