Skip to content

Merge pull request #114 from konsept-ch/invoices #404

Merge pull request #114 from konsept-ch/invoices

Merge pull request #114 from konsept-ch/invoices #404

name: Docker Publish
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
workflow_dispatch:
release:
types: [released]
push:
branches: [main]
# push:
# branches: [$default-branch]
# # Publish semver tags as releases.
# tags: ['v*.*.*']
# pull_request:
# branches: [$default-branch]
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-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
# if: ${{ github.event_name == 'release' }}
id: build-and-push-if-release
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
FONTAWESOME_NPM_AUTH_TOKEN=${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
provenance: false
# - name: (Val - workflow_dispatch) Build and push Docker image
# if: ${{ github.event_name == 'workflow_dispatch' }}
# # if: ${{ github.event_name == 'release' }}
# id: build-and-push-if-manual
# uses: docker/build-push-action@v3
# with:
# context: .
# push: ${{ github.event_name != 'pull_request' }}
# tags: ${{ steps.meta.outputs.tags }}-uat
# labels: ${{ steps.meta.outputs.labels }}
# build-args: |
# FONTAWESOME_NPM_AUTH_TOKEN=${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
# REACT_APP_SERVICES_URL=https://middleware.cep-val.ch
# provenance: false