# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) # # SPDX-License-Identifier: AGPL-3.0-only name: Frontend / build docker image on: push: branches: [ develop ] defaults: run: working-directory: frontend concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }} cancel-in-progress: true permissions: contents: read packages: write jobs: changes: name: Check for frontend changes runs-on: ubuntu-latest permissions: pull-requests: read outputs: changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }} steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 if: github.event_name != 'push' - name: Check for frontend file changes if: github.event_name != 'push' uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 id: changed with: filters: | files: - 'commons/**' - 'frontend/**' - '.github/**' - '.yarn/**' build: needs: changes runs-on: ubuntu-latest steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 if: needs.changes.outputs.changed == 'true' - name: Generate Docker metadata if: needs.changes.outputs.changed == 'true' id: meta uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0 with: images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} tags: | type=ref,event=branch type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - name: Set up QEMU if: needs.changes.outputs.changed == 'true' uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 - name: Set up Docker Buildx if: needs.changes.outputs.changed == 'true' uses: docker/setup-buildx-action@5e716dcfd653738c2d1db099bfba194a84158be4 # v2.3.0 - name: Login to GHCR if: github.event_name != 'pull_request' && needs.changes.outputs.changed == 'true' uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push if: needs.changes.outputs.changed == 'true' uses: docker/build-push-action@37abcedcc1da61a57767b7588cb9d03eb57e28b3 # v3.3.0 with: push: true file: frontend/docker/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 }}