Skip to content

Commit 575b7b2

Browse files
committed
fast deploy
1 parent 9a4678f commit 575b7b2

File tree

1 file changed

+112
-12
lines changed

1 file changed

+112
-12
lines changed

.github/workflows/release.yml

Lines changed: 112 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ env:
1212
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKERHUB_USERNAME }}/marreta
1313

1414
jobs:
15-
docker-build:
16-
name: 🐳 Build and Push
17-
runs-on: ubuntu-latest
15+
docker-build-amd64:
16+
name: 🐳 Build and Push (AMD64)
17+
runs-on: ubuntu-24.04
1818
permissions:
1919
contents: read
2020
packages: write
@@ -32,8 +32,6 @@ jobs:
3232

3333
- name: 🛠️ Set up Docker Buildx
3434
uses: docker/setup-buildx-action@v3
35-
with:
36-
platforms: linux/amd64,linux/arm64,linux/arm/v7
3735

3836
- name: 📋 Extract Docker metadata
3937
id: meta
@@ -46,6 +44,9 @@ jobs:
4644
type=semver,pattern={{version}}
4745
type=semver,pattern={{major}}.{{minor}}
4846
type=sha
47+
type=raw,value=latest
48+
flavor: |
49+
suffix=-amd64
4950
5051
- name: 🔐 Log in to GitHub Registry
5152
uses: docker/login-action@v3
@@ -54,27 +55,126 @@ jobs:
5455
username: ${{ github.actor }}
5556
password: ${{ secrets.GITHUB_TOKEN }}
5657

57-
- name: 🔐 Log in to Docker Hub
58+
- name: 🏗️ Build and Push (AMD64)
59+
uses: docker/build-push-action@v5
60+
with:
61+
context: .
62+
platforms: linux/amd64
63+
push: true
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}
66+
cache-from: type=gha,scope=amd64
67+
cache-to: type=gha,mode=max,scope=amd64
68+
69+
docker-build-arm64:
70+
name: 🐳 Build and Push (ARM64)
71+
runs-on: ubuntu-24.04-arm
72+
permissions:
73+
contents: read
74+
packages: write
75+
76+
steps:
77+
- name: 📥 Checkout code
78+
uses: actions/checkout@v4
79+
80+
- name: 🏷️ Extract version from tag
81+
id: get_version
82+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
83+
84+
- name: 🛠️ Set up Docker Buildx
85+
uses: docker/setup-buildx-action@v3
86+
87+
- name: 📋 Extract Docker metadata
88+
id: meta
89+
uses: docker/metadata-action@v5
90+
with:
91+
images: |
92+
${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
93+
${{ env.DOCKERHUB_REPOSITORY }}
94+
tags: |
95+
type=semver,pattern={{version}}
96+
type=semver,pattern={{major}}.{{minor}}
97+
type=sha
98+
type=raw,value=latest
99+
flavor: |
100+
suffix=-arm64
101+
102+
- name: 🔐 Log in to GitHub Registry
58103
uses: docker/login-action@v3
59104
with:
60105
username: ${{ secrets.DOCKERHUB_USERNAME }}
61106
password: ${{ secrets.DOCKERHUB_TOKEN }}
107+
registry: ${{ env.DOCKER_REGISTRY }}
108+
username: ${{ github.actor }}
109+
password: ${{ secrets.GITHUB_TOKEN }}
62110

63-
- name: 🏗️ Build and Push
111+
- name: 🏗️ Build and Push (ARM64)
64112
uses: docker/build-push-action@v5
65113
with:
66114
context: .
67-
platforms: linux/amd64,linux/arm64,linux/arm/v7
115+
platforms: linux/arm64
68116
push: true
69117
tags: ${{ steps.meta.outputs.tags }}
70118
labels: ${{ steps.meta.outputs.labels }}
71-
cache-from: type=gha
72-
cache-to: type=gha,mode=max
119+
cache-from: type=gha,scope=arm64
120+
cache-to: type=gha,mode=max,scope=arm64
121+
122+
docker-manifest:
123+
name: 🔗 Create Multi-Platform Manifest
124+
runs-on: ubuntu-24.04
125+
needs: [docker-build-amd64, docker-build-arm64]
126+
permissions:
127+
contents: read
128+
packages: write
129+
130+
steps:
131+
- name: 📥 Checkout code
132+
uses: actions/checkout@v4
133+
134+
- name: 🏷️ Extract version from tag
135+
id: get_version
136+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
137+
138+
- name: 📋 Extract Docker metadata
139+
id: meta
140+
uses: docker/metadata-action@v5
141+
with:
142+
images: |
143+
${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
144+
${{ env.DOCKERHUB_REPOSITORY }}
145+
tags: |
146+
type=semver,pattern={{version}}
147+
type=semver,pattern={{major}}.{{minor}}
148+
type=sha
149+
type=raw,value=latest
150+
151+
- name: 🔐 Log in to GitHub Registry
152+
uses: docker/login-action@v3
153+
with:
154+
registry: ${{ env.DOCKER_REGISTRY }}
155+
username: ${{ github.actor }}
156+
password: ${{ secrets.GITHUB_TOKEN }}
157+
158+
- name: 🛠️ Set up Docker Buildx
159+
uses: docker/setup-buildx-action@v3
160+
161+
- name: 🔗 Create and Push Multi-Platform Manifest
162+
run: |
163+
# Extract the main tags (without suffixes)
164+
TAGS="${{ steps.meta.outputs.tags }}"
165+
166+
for tag in $TAGS; do
167+
echo "Creating manifest for $tag"
168+
docker buildx imagetools create \
169+
--tag $tag \
170+
$tag-amd64 \
171+
$tag-arm64
172+
done
73173
74174
publish-release:
75175
name: 📦 Publish Release
76-
runs-on: ubuntu-latest
77-
needs: docker-build
176+
runs-on: ubuntu-24.04
177+
needs: [docker-build-amd64, docker-build-arm64, docker-manifest]
78178
permissions:
79179
contents: write
80180

0 commit comments

Comments
 (0)