Skip to content

Update docker-publish.yml #49

Update docker-publish.yml

Update docker-publish.yml #49

Workflow file for this run

name: Docker
on:
schedule:
- cron: '26 13 * * *'
push:
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20
with:
cosign-release: 'v2.2.4'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push multiple Docker images
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
with:
# Define multiple contexts and tags
contexts: |
app1=./fetcher/Dockerfile
app2=./bulkImporter/Dockerfile
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-fetcher:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-importer:latest
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Sign the published Docker images
if: ${{ github.event_name != 'pull_request' }}
run: |
TAGS=("fetcher" "importer")
for tag in "${TAGS[@]}"; do
cosign sign --yes "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${tag}:latest"
done