2022-12-11 18:46:30 -05:00
|
|
|
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
name: Docker
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ develop ]
|
2023-10-08 11:19:38 -04:00
|
|
|
tags: [ v2* ]
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
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 11:16:05 -05:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
component: [ 'backend', 'frontend' ]
|
2022-12-11 18:46:30 -05:00
|
|
|
steps:
|
2023-10-17 14:05:43 -04:00
|
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
2022-12-11 18:46:30 -05:00
|
|
|
|
2023-02-08 11:16:05 -05:00
|
|
|
- name: Generate Docker metadata for ${{ matrix.component }}
|
|
|
|
id: meta-data
|
2023-12-07 14:55:10 -05:00
|
|
|
uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
2023-02-08 11:16:05 -05:00
|
|
|
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ matrix.component }}
|
2022-12-11 18:46:30 -05:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
2023-09-22 05:12:48 -04:00
|
|
|
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-09-22 05:12:42 -04:00
|
|
|
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
2022-12-11 18:46:30 -05:00
|
|
|
|
|
|
|
- name: Login to GHCR
|
2023-09-22 04:39:06 -04:00
|
|
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2023-02-08 11:16:05 -05:00
|
|
|
- name: Build and push
|
2023-12-07 14:28:32 -05:00
|
|
|
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
|
2022-12-11 18:46:30 -05:00
|
|
|
with:
|
|
|
|
push: true
|
2023-02-08 11:16:05 -05:00
|
|
|
file: ${{ matrix.component}}/docker/Dockerfile
|
|
|
|
tags: ${{ steps.meta-data.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta-data.outputs.labels }}
|
2022-12-11 18:46:30 -05:00
|
|
|
cache-from: type=gha
|
2023-02-18 09:22:21 -05:00
|
|
|
cache-to: type=gha
|
2022-12-11 18:46:30 -05:00
|
|
|
context: .
|
2023-02-07 15:50:25 -05: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 }}
|