Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 8596337

Browse files
authored
Multiarch (obeone#1)
* Build multiarch + build all PR and blranches * Rewrite to avoid cache and build and push in the same job * Disable cache and docker image repository
1 parent 36aa008 commit 8596337

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

.github/workflows/build-and-push.yaml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ on:
33
schedule:
44
- cron: '23 2 * * *'
55
push:
6-
branches:
7-
- main
86
pull_request:
9-
branches:
10-
- main
117

128

139

@@ -52,23 +48,13 @@ jobs:
5248
# Login against a Docker registry except on PR
5349
# https://github.com/docker/login-action
5450
- name: Log into registry ${{ env.REGISTRY }}
55-
if: github.event_name != 'pull_request'
51+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
5652
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
5753
with:
5854
registry: ${{ env.REGISTRY }}
5955
username: ${{ secrets.REGISTRY_USER }}
6056
password: ${{ secrets.REGISTRY_PW }}
6157

62-
- name: Build image
63-
id: build
64-
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
65-
with:
66-
context: .
67-
pull: true
68-
load: true
69-
tags: docker-nfs-server:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
70-
cache-to: type=gha,mode=max
71-
cache-from: type=gha,mode=max
7258

7359
- name: Finding latest release
7460
id: version
@@ -83,16 +69,21 @@ jobs:
8369
with:
8470
input_string: "${{ steps.version.outputs.release }}"
8571

86-
87-
- name: Publish image
88-
id: push
89-
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
72+
- name: Build image
73+
id: build
74+
uses: docker/build-push-action@v2
9075
with:
9176
context: .
92-
push: true
93-
pull: true
94-
cache-to: type=gha,mode=max
95-
cache-from: type=gha,mode=max
77+
platforms: |
78+
linux/amd64
79+
linux/arm64
80+
linux/i386
81+
linux/armhf
82+
linux/armel
83+
84+
# pull: true
85+
# load: true
86+
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
9687
tags: |
9788
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.semver_parser.outputs.major }}
9889
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}

0 commit comments

Comments
 (0)