fix(frontend): adjust workflows

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-11-11 10:55:08 +01:00
parent 31e4ab5e37
commit 9db45b74b8
No known key found for this signature in database
GPG key ID: B97799103358209B
6 changed files with 267 additions and 41 deletions

View file

@ -2,17 +2,45 @@
#
# SPDX-License-Identifier: AGPL-3.0-only
name: Build Docker Image
name: Frontend / build docker image
on:
push:
branches: [ main ]
branches: [ develop ]
defaults:
run:
working-directory: frontend
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Check for frontend changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
changed: ${{ steps.changed.outputs.files }}
steps:
- name: Check for frontend file changes
uses: dorny/paths-filter@v2
id: changed
with:
filters: |
files:
- 'frontend/**'
- '.github/**'
- '.yarn/**'
build:
needs: changes
runs-on: ubuntu-latest
steps:
- name: Generate Docker metadata
if: needs.changes.outputs.changed == 'true'
id: meta
uses: docker/metadata-action@v4
with:
@ -24,13 +52,15 @@ jobs:
type=semver,pattern={{major}}
- name: Set up QEMU
if: needs.changes.outputs.changed == 'true'
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: needs.changes.outputs.changed == 'true'
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' && needs.changes.outputs.changed == 'true'
uses: docker/login-action@v2
with:
registry: ghcr.io
@ -38,13 +68,15 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
if: needs.changes.outputs.changed == 'true'
uses: docker/build-push-action@v3
with:
push: true
file: Dockerfile
file: frontend/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
build-args: |
BUILD_VERSION=${{ github.event.head_commit.id }}