f8a310288a
This assigns the OCI spec labels to images pushed to GHCR, and enables image users to see current tool version instead of just v0+HEAD.
55 lines
1.8 KiB
YAML
55 lines
1.8 KiB
YAML
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
|