-
Notifications
You must be signed in to change notification settings - Fork 45
94 lines (82 loc) · 2.51 KB
/
Copy pathrelease-docker.yaml
File metadata and controls
94 lines (82 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Release Docker
on:
push:
branches:
- main
tags: ["*"]
permissions:
contents: read
packages: write
jobs:
publish:
strategy:
matrix:
include:
- runner: ubuntu-latest
arch: amd64
- runner: ubuntu-24.04-arm
arch: arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve Docker tag
id: tag
shell: bash
run: |
set -euo pipefail
image="ghcr.io/scip-code/scip-java"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
version="${GITHUB_REF_NAME#v}"
tag="${image}:${version}-${{ matrix.arch }}"
else
tag="${image}:latest-snapshot-${{ matrix.arch }}"
fi
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
push: true
platforms: linux/${{ matrix.arch }}
tags: ${{ steps.tag.outputs.tag }}
labels: |
org.opencontainers.image.source=https://github.com/scip-code/scip-java
org.opencontainers.image.revision=${{ github.sha }}
publish-manifest:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push multi-arch manifest
shell: bash
run: |
set -euo pipefail
image="ghcr.io/scip-code/scip-java"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
version="${GITHUB_REF_NAME#v}"
docker buildx imagetools create \
--tag "${image}:latest" \
--tag "${image}:${version}" \
"${image}:${version}-amd64" \
"${image}:${version}-arm64"
else
docker buildx imagetools create \
--tag "${image}:latest-snapshot" \
"${image}:latest-snapshot-amd64" \
"${image}:latest-snapshot-arm64"
fi