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-06-09 15:13:45 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
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-06-13 11:29:16 +00:00
|
|
|
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.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
|
2023-06-07 17:59:17 +00:00
|
|
|
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
|
2022-12-11 23:46:30 +00:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-07-12 13:43:02 +00:00
|
|
|
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
|
2022-12-11 23:46:30 +00:00
|
|
|
|
|
|
|
- name: Login to GHCR
|
2023-06-07 13:16:29 +00:00
|
|
|
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
|
2022-12-11 23:46:30 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-02-08 16:16:05 +00:00
|
|
|
- name: Build and push
|
2023-06-13 11:29:09 +00:00
|
|
|
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
|
2022-12-11 23:46:30 +00:00
|
|
|
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 }}
|