Files
UpSnap/.github/workflows/deploy-docker.yml
2023-01-29 14:17:12 +01:00

59 lines
1.5 KiB
YAML

name: Publish docker images
on:
push:
tags:
- "v3.*.*"
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
steps:
# pull code
- name: Check Out Repo
uses: actions/checkout@v3
# extract tags
- name: Prepare tags
id: prep
run: |
DOCKER_IMAGE=ghcr.io/seriousm4x/upsnap
VERSION=${{github.ref_name}}
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${VERSION:0:2},${DOCKER_IMAGE}:latest"
echo ::set-output name=tags::${TAGS}
# qemu
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# docker buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# ghcr.io login
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# build and push
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ steps.prep.outputs.tags }}
build-args: |
VERSION=${{github.ref_name}}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}