Skip to content

Commit a7ac2e6

Browse files
committed
GitHub workflow that builds a multi-platform Docker image and pushes it to Docker Hub
1 parent e2ad895 commit a7ac2e6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/image.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Login to Docker Hub
13+
uses: docker/login-action@v3
14+
with:
15+
username: ${{ vars.DOCKERHUB_USERNAME }}
16+
password: ${{ secrets.DOCKERHUB_TOKEN }}
17+
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v3
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Extract version parts
25+
id: version
26+
run: |
27+
VERSION="${{ github.ref_name }}"
28+
MAJOR="${VERSION%%.*}"
29+
MINOR="${VERSION%.*}"
30+
MINOR="${MINOR#*.}"
31+
echo "MAJOR=$MAJOR" >> $GITHUB_ENV
32+
echo "MINOR=$MAJOR.$MINOR" >> $GITHUB_ENV
33+
echo "FULL_VERSION=$VERSION" >> $GITHUB_ENV
34+
35+
- name: Build and push
36+
uses: docker/build-push-action@v6
37+
with:
38+
platforms: linux/amd64,linux/arm64
39+
push: true
40+
tags: |
41+
atomgraph/linkeddatahub:latest
42+
atomgraph/linkeddatahub:${{ env.FULL_VERSION }}
43+
atomgraph/linkeddatahub:${{ env.MINOR }}
44+
atomgraph/linkeddatahub:${{ env.MAJOR }}

0 commit comments

Comments
 (0)