1111 IMAGE_NAME : eibrahim/fluid-calendar
1212
1313jobs :
14- build-amd64 :
14+ build :
1515 runs-on : ubuntu-latest
1616 permissions :
1717 contents : read
@@ -37,12 +37,12 @@ jobs:
3737 with :
3838 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3939 tags : |
40- type=raw,value=latest-amd64 ,enable={{is_default_branch}}
41- type=ref,event=branch,suffix=-amd64
42- type=ref,event=pr,suffix=-amd64
43- type=semver,pattern={{version}}-amd64
44- type=semver,pattern={{major}}.{{minor}}-amd64
45- type=sha,suffix=-amd64
40+ type=raw,value=latest,enable={{is_default_branch}}
41+ type=ref,event=branch
42+ type=ref,event=pr
43+ type=semver,pattern={{version}}
44+ type=semver,pattern={{major}}.{{minor}}
45+ type=sha
4646
4747 - name : Build and push Docker image
4848 uses : docker/build-push-action@v5
@@ -52,103 +52,6 @@ jobs:
5252 push : ${{ github.event_name != 'pull_request' }}
5353 tags : ${{ steps.meta.outputs.tags }}
5454 labels : ${{ steps.meta.outputs.labels }}
55- platforms : linux/amd64
55+ platforms : linux/amd64,linux/arm64
5656 cache-from : type=gha
5757 cache-to : type=gha,mode=max
58-
59- build-arm64 :
60- runs-on : self-hosted
61- permissions :
62- contents : read
63- packages : write
64-
65- steps :
66- - name : Checkout repository
67- uses : actions/checkout@v4
68-
69- - name : Set up Docker Buildx
70- uses : docker/setup-buildx-action@v3
71-
72- - name : Log into Docker Hub
73- if : github.event_name != 'pull_request'
74- uses : docker/login-action@v3
75- with :
76- username : ${{ secrets.DOCKERHUB_USERNAME }}
77- password : ${{ secrets.DOCKERHUB_TOKEN }}
78-
79- - name : Extract Docker metadata
80- id : meta
81- uses : docker/metadata-action@v5
82- with :
83- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
84- tags : |
85- type=raw,value=latest-arm64,enable={{is_default_branch}}
86- type=ref,event=branch,suffix=-arm64
87- type=ref,event=pr,suffix=-arm64
88- type=semver,pattern={{version}}-arm64
89- type=semver,pattern={{major}}.{{minor}}-arm64
90- type=sha,suffix=-arm64
91-
92- - name : Build and push Docker image
93- uses : docker/build-push-action@v5
94- with :
95- context : .
96- file : docker/production/Dockerfile
97- push : ${{ github.event_name != 'pull_request' }}
98- tags : ${{ steps.meta.outputs.tags }}
99- labels : ${{ steps.meta.outputs.labels }}
100- platforms : linux/arm64
101- cache-from : type=local,src=/tmp/.buildx-cache
102- cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
103-
104- - name : Move cache
105- run : |
106- rm -rf /tmp/.buildx-cache
107- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
108-
109- create-manifest :
110- needs : [build-amd64, build-arm64]
111- runs-on : ubuntu-latest
112- if : github.event_name != 'pull_request'
113- steps :
114- - name : Set up Docker Buildx
115- uses : docker/setup-buildx-action@v3
116-
117- - name : Login to Docker Hub
118- uses : docker/login-action@v3
119- with :
120- username : ${{ secrets.DOCKERHUB_USERNAME }}
121- password : ${{ secrets.DOCKERHUB_TOKEN }}
122-
123- - name : Create and push manifest
124- run : |
125- # Login directly with Docker CLI to ensure proper token scope
126- echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
127-
128- # Enable experimental features for docker
129- mkdir -p ~/.docker
130- echo '{"experimental": "enabled"}' > ~/.docker/config.json
131-
132- # For main branch or latest tag
133- if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
134- # Create a manifest directly without pulling
135- docker buildx imagetools create --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
136- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-amd64 \
137- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-arm64
138- fi
139-
140- # For tags (releases)
141- if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
142- VERSION=${GITHUB_REF#refs/tags/v}
143-
144- # Create version tag manifest
145- docker buildx imagetools create --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
146- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-amd64 \
147- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-arm64
148-
149- # Create major.minor tag manifest
150- MAJOR_MINOR=$(echo ${VERSION} | cut -d. -f1,2)
151- docker buildx imagetools create --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${MAJOR_MINOR} \
152- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-amd64 \
153- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-arm64
154- fi
0 commit comments