Skip to content

Merge pull request #42 from grossherzogin-elisabeth/dependabot/npm_an… #31

Merge pull request #42 from grossherzogin-elisabeth/dependabot/npm_an…

Merge pull request #42 from grossherzogin-elisabeth/dependabot/npm_an… #31

Workflow file for this run

name: Build and push Docker container
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-push-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/[email protected]
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into ghcr registry
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Get current date
id: date
run: echo "::set-output name=date::$(date '+%Y-%m-%d %H:%M:%S')"
- name: Build and push Docker image (main)
if: ${{ github.ref == 'refs/heads/main' }}
id: build-and-push-main
uses: docker/[email protected]
with:
context: .
build-args: |
COMMIT=${{ github.sha }}
BRANCH=${{ github.head_ref || github.ref_name }}
TIME=${{ steps.date.outputs.date }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/grossherzogin-elisabeth/eventplanner:latest
ghcr.io/grossherzogin-elisabeth/eventplanner:1.0.0-alpha
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push Docker image (dev)
if: ${{ github.ref != 'refs/heads/main' }}
id: build-and-push-dev
uses: docker/[email protected]
with:
context: .
build-args: |
COMMIT=${{ github.sha }}
BRANCH=${{ github.head_ref || github.ref_name }}
TIME=${{ steps.date.outputs.date }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/grossherzogin-elisabeth/eventplanner:${{ github.head_ref || github.ref_name }}
cache-from: type=gha
cache-to: type=gha,mode=max