2022-12-11 23:46:30 +00:00
|
|
|
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
name: Docker
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ develop ]
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.job }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push:
|
|
|
|
runs-on: ubuntu-latest
|
2023-02-08 16:16:05 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
component: [ 'backend', 'frontend' ]
|
2022-12-11 23:46:30 +00:00
|
|
|
steps:
|
2023-04-13 13:45:37 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2022-12-11 23:46:30 +00:00
|
|
|
|
2023-02-08 16:16:05 +00:00
|
|
|
- name: Generate Docker metadata for ${{ matrix.component }}
|
|
|
|
id: meta-data
|
2023-04-18 07:39:28 +00:00
|
|
|
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e # v4.4.0
|
2022-12-11 23:46:30 +00:00
|
|
|
with:
|
2023-02-08 16:16:05 +00:00
|
|
|
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ matrix.component }}
|
2022-12-11 23:46:30 +00:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-03-11 13:21:13 +00:00
|
|
|
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
|
2022-12-11 23:46:30 +00:00
|
|
|
|
|
|
|
- name: Login to GHCR
|
|
|
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-02-08 16:16:05 +00:00
|
|
|
- name: Build and push
|
2022-12-11 23:46:30 +00:00
|
|
|
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
|
|
|
with:
|
|
|
|
push: true
|
2023-02-08 16:16:05 +00:00
|
|
|
file: ${{ matrix.component}}/docker/Dockerfile
|
|
|
|
tags: ${{ steps.meta-data.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta-data.outputs.labels }}
|
2022-12-11 23:46:30 +00:00
|
|
|
cache-from: type=gha
|
2023-02-18 14:22:21 +00:00
|
|
|
cache-to: type=gha
|
2022-12-11 23:46:30 +00:00
|
|
|
context: .
|
2023-02-07 20:50:25 +00:00
|
|
|
build-args: |
|
|
|
|
BUILD_VERSION=${{ github.event.head_commit.id }}
|
|
|
|
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
|
|
|
|
TURBO_API=${{ vars.TURBO_API }}
|
|
|
|
TURBO_TEAM=${{ vars.TURBO_TEAM }}
|