Skip to content

Merge pull request #1 from fendent/main #12

Merge pull request #1 from fendent/main

Merge pull request #1 from fendent/main #12

Workflow file for this run

name: Publish Docker image
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set short Git-SHA
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-8)" >> $GITHUB_ENV
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build container image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64, linux/arm64
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/gibstick/pin-archive-3:${{ env.GITHUB_SHA_SHORT}}
ghcr.io/gibstick/pin-archive-3:latest
cache-from: type=gha
cache-to: type=gha,mode=max