Improved exceptions handling and debug logging #147
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build a Docker image and push it to GitHub Container Registry | |
# See https://github.com/docker/build-push-action/blob/master/.github/workflows/example.yml | |
name: Docker Build and Push | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: # Manually trigger the workflow | |
defaults: | |
run: | |
shell: bash | |
env: | |
DOCKER_IMAGE: oauth-examples | |
jobs: | |
build-push: | |
name: Build and Push | |
runs-on: ubuntu-22.04 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
# Calculates docker image tags for the given build context | |
# The output is used in build and push step as `tags: ${{ steps.docker_meta.outputs.tags }}` | |
# See https://github.com/crazy-max/ghaction-docker-meta | |
name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v5 | |
with: | |
# List of Docker images to use as base name for tags | |
images: | | |
ghcr.io/wesalute/${{ env.DOCKER_IMAGE }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=branch,suffix=-{{date 'YYYYMMDDHHmmss'}} | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
- | |
name: Login to GitHub Container Registry (GHCR) | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
# Build and export the image into the registry | |
# This will pick-up the build cache from the local build step | |
name: Build and push to GitHub Container Registry | |
id: docker_build_push | |
if: ${{ steps.docker_meta.outputs.tags != '' }} # Don't run if the list of tags from the docker_meta step is empty | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
build-args: | | |
APP_BASE_PATH=/oauth-examples | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
push: ${{ github.event_name != 'pull_request' }} # Don't push for PRs |