Skip to content

Commit 6e1f131

Browse files
committed
ci: test container multiplatform build and push
pushes amd64 and arm64 images, then mixes in a next step
1 parent 8366055 commit 6e1f131

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

.github/workflows/dev_container.yml

+17-34
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ jobs:
7474
submodules: false
7575
fetch-depth: 0
7676

77+
- name: Login to Docker Hub
78+
uses: docker/login-action@v3
79+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
80+
with:
81+
username: ${{ secrets.DOCKERHUB_USERNAME }}
82+
password: ${{ secrets.DOCKERHUB_TOKEN }}
83+
84+
- name: Login to GitHub Container Registry
85+
uses: docker/login-action@v3
86+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
87+
with:
88+
registry: ghcr.io
89+
username: ${{ github.actor }}
90+
password: ${{ secrets.GITHUB_TOKEN }}
91+
7792
- name: Set up Docker Buildx
7893
uses: docker/setup-buildx-action@v3
7994
with:
@@ -88,7 +103,7 @@ jobs:
88103
labels: ${{ needs.setup.outputs.meta_labels }}
89104
platforms: ${{ env.PLATFORM_NAME }}
90105
load: false
91-
push: false
106+
push: true
92107
cache-from: type=gha,version=1
93108
cache-to: type=gha,version=1,mode=max
94109

@@ -114,26 +129,6 @@ jobs:
114129
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
115130
steps:
116131
- uses: runs-on/action@v1
117-
- uses: actions/checkout@v4
118-
with:
119-
fetch-tags: true
120-
submodules: false
121-
fetch-depth: 0
122-
123-
- name: Set PX4 Tag Version
124-
id: px4_version
125-
run: |
126-
echo "px4_version=$(git describe --tags --match 'v[0-9]*')" >> $GITHUB_OUTPUT
127-
128-
- name: Extract metadata (tags, labels) for Docker
129-
id: meta
130-
uses: docker/metadata-action@v5
131-
with:
132-
images: |
133-
ghcr.io/PX4/px4-dev
134-
px4io/px4-dev
135-
tags: |
136-
type=raw,enable=true,value=${{ needs.setup.outputs.px4_version }},priority=1000
137132

138133
- name: Login to Docker Hub
139134
uses: docker/login-action@v3
@@ -150,18 +145,6 @@ jobs:
150145
username: ${{ github.actor }}
151146
password: ${{ secrets.GITHUB_TOKEN }}
152147

153-
- name: Cache Apt Registry
154-
uses: runs-on/cache@v4
155-
id: cache
156-
with:
157-
path: |
158-
var-cache-apt
159-
var-lib-apt
160-
key: cache-${{ hashFiles('Tools/setup/Dockerfile') }}
161-
162-
- name: Set up Docker Buildx
163-
uses: docker/setup-buildx-action@v3
164-
165148
- name: Push Images to Registry
166149
uses: docker/build-push-action@v6
167150
with:
@@ -170,6 +153,6 @@ jobs:
170153
labels: ${{ needs.setup.outputs.meta_labels }}
171154
platforms: linux/amd64,linux/arm64
172155
load: false
173-
push: ${{ startsWith(github.ref, 'refs/tags/') }}
156+
push: true
174157
cache-from: type=gha,version=1
175158
cache-to: type=gha,version=1,mode=max

0 commit comments

Comments
 (0)