-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (65 loc) · 2.14 KB
/
deploy.yml
File metadata and controls
71 lines (65 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Deploy Prebuilt Containers
on:
workflow_run:
workflows:
- Build and Push Docker Images
branches:
- main
types:
- completed
workflow_dispatch:
inputs:
image-tag:
description: "Image tag to deploy (e.g. latest, main, pr-123)"
type: string
required: false
default: latest
concurrency:
group: deploy-production
cancel-in-progress: false
jobs:
verify-images:
name: Verify ${{ matrix.label }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: client image
image: ghcr.io/ls1intum/learn-hub/client
- label: server image
image: ghcr.io/ls1intum/learn-hub/server
permissions:
packages: read
env:
DEPLOY_IMAGE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.image-tag || 'latest' }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check required image exists
run: |
set -euo pipefail
image_ref="${{ matrix.image }}:${DEPLOY_IMAGE_TAG}"
echo "Checking ${image_ref}"
docker buildx imagetools inspect "${image_ref}" > /dev/null
deploy:
needs: verify-images
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
packages: read
uses: ls1intum/.github/.github/workflows/deploy-docker-compose.yml@main
with:
environment: production
docker-compose-file: ./docker/compose.prod.yml
main-image-name: ls1intum/learn-hub/server
image-tag: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.image-tag || 'latest' }}
deployment-base-path: ${{ vars.DEPLOYMENT_BASE_PATH }}
secrets: inherit