55 lines (53 loc) · 1.79 KB
/
docker.yml
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
name: Push to GHCR
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
required: true
description: "Build specific tag"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set tag name from manual dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "tag_name=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
- name: Set tag name from Git
if: ${{ github.event_name == 'push' }}
run: |
echo "tag_name=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ env.tag_name }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v1
- name: Login to registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.tag_name }}
build-args: |
gmnhg_version=${{ env.tag_name }}
# TODO: set org.opencontainers.image.revision when this gets
# fixed: https://github.com/actions/checkout/issues/209
labels: |
org.opencontainers.image.url="${{ github.server_url }}/${{ github.repository }}"
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.version=${{ env.tag_name }}
org.opencontainers.image.licenses=GPL-3.0
org.opencontainers.image.title=gmnhg