spiff-arena/.github/workflows/create-docker-action.yml

60 lines
1.4 KiB
YAML

name: run_ci
on:
workflow_dispatch:
push:
branches: ['feature/releases'] # just for testing for a bit.
tags:
- 'v*'
pull_request:
branches:
- 'main'
release:
types: [published]
env:
REGISTRY: ghcr.io
BACKEND_IMAGE: spiffworkflow-backend
jobs:
build-and-push-backend-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
sartography/spiffworkflow-backend
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Setting up Docker Buildx with docker-container driver is required
# at the moment to be able to use a subdirectory with Git context
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Backend Docker Image
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:spiffworkflow-backend"
push: true
tags: sartography/spiffworkflow-backend:latest
labels: ${{ steps.meta.outputs.labels }}