Merge pull request #406 from mawoka-myblock/import-template-update #103
This file contains 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
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka) | |
# | |
# SPDX-License-Identifier: MPL-2.0 | |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: "[CI] Frontend / Build" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
paths: | |
- "frontend/**" | |
# pull_request: | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: mawoka-myblock/classquiz-frontend | |
jobs: | |
build: | |
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@v3 | |
- name: Set correct options in Dockerfile | |
run: | | |
sed -i "s/VITE_GOOGLE_AUTH_ENABLED=true/VITE_GOOGLE_AUTH_ENABLED=false/g" frontend/Dockerfile | |
sed -i "s/VITE_GITHUB_AUTH_ENABLED=true/VITE_GITHUB_AUTH_ENABLED=false/g" frontend/Dockerfile | |
sed -i "s/VITE_CAPTCHA_ENABLED=true/VITE_CAPTCHA_ENABLED=false/g" frontend/Dockerfile | |
# Install the cosign tool except on PR | |
# https://github.com/sigstore/cosign-installer | |
- name: Install cosign | |
if: github.event_name != 'pull_request' | |
uses: sigstore/cosign-installer@v3.0.1 | |
with: | |
cosign-release: 'v2.0.0' | |
# Workaround: https://github.com/docker/build-push-action/issues/461 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v2.2.1 | |
# 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.1.0 | |
with: | |
registry: ghcr.io | |
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.3.0 | |
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 | |
id: build-and-push | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
context: "./frontend" | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 |