-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (52 loc) · 1.53 KB
/
Copy pathdocker.yml
File metadata and controls
60 lines (52 loc) · 1.53 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
name: Docker
on:
push:
tags:
- "v*.*.*"
release:
types:
- published
workflow_dispatch:
inputs:
version:
description: Image tag, for example v0.1.0
required: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: colvin-y/kubernetes-ontology
RELEASE_VERSION: ${{ github.event.release.tag_name || (github.ref_type == 'tag' && github.ref_name) || inputs.version }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image tags
shell: bash
run: |
set -euo pipefail
if [ -z "${RELEASE_VERSION}" ]; then
echo "RELEASE_VERSION is required" >&2
exit 1
fi
echo "IMAGE_VERSION=${RELEASE_VERSION#v}" >> "${GITHUB_ENV}"
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest