autobahn/.github/ci-docker-publish.yml

55 lines
1.3 KiB
YAML

name: Publish Docker Image to GHCR
on:
push:
branches: [main]
paths:
[
".github/ci-docker-publish.yml",
"programs/**",
"lib/**",
"bin/autobahn-router/**",
]
workflow_dispatch:
env:
IMAGE: autobahn-router
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
# Use docker buildx
- name: Use docker buildx
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true
buildkitd-flags: --debug
# Login to Registry
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build and push the base image, leveraging layer caching
- name: Build and Push Base Image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:${{ github.sha }}
${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max