59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
name: Publish Docker image
|
|
|
|
on:
|
|
release:
|
|
types: [ published ]
|
|
|
|
jobs:
|
|
push_to_registry:
|
|
name: Push Docker image to GitHub Registry
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: |
|
|
ghcr.io/kpcyrd/sn0int
|
|
tags: |
|
|
type=semver,pattern={{raw}}
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
-
|
|
name: Cache Docker layers
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
-
|
|
name: Login to Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
name: Build and push Docker images
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
file: Dockerfile
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
|
-
|
|
# Temp fix
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
name: Move cache
|
|
run: |
|
|
rm -rf /tmp/.buildx-cache
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|