Skip to content

Merge pull request #11 from Alistair1231/docker-support #1

Merge pull request #11 from Alistair1231/docker-support

Merge pull request #11 from Alistair1231/docker-support #1

Workflow file for this run

name: Docker
on:
push:
branches:
- "*"
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker buildx build --cache-to type=gha --cache-from type=gha -t image .
- name: Push image
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
GITHUB_ID="ghcr.io/${{ github.repository }}"
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' -e 's,^v,,')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
set -x
docker tag image $GITHUB_ID:$VERSION
docker push $GITHUB_ID:$VERSION