-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.24 KB
/
deploy.yml
File metadata and controls
78 lines (66 loc) · 2.24 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
72
73
74
75
76
77
78
name: Deploy
on:
push:
branches:
- main
paths:
- "packages/web/**"
- "packages/shared/**"
- "packages/worker/**"
- ".github/workflows/deploy.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
name: Build and Push Docker Images
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Log in to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
- name: Normalize GHCR image names
run: |
REPO_LOWER=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
echo "WEB_IMAGE=${REGISTRY}/${REPO_LOWER}/sovra-web" >> "$GITHUB_ENV"
echo "WORKER_IMAGE=${REGISTRY}/${REPO_LOWER}/sovra-worker" >> "$GITHUB_ENV"
- name: Build and push web image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf
with:
context: .
file: packages/web/Dockerfile
push: true
tags: |
${{ env.WEB_IMAGE }}:${{ github.sha }}
${{ env.WEB_IMAGE }}:latest
cache-from: type=gha,scope=web
cache-to: type=gha,mode=min,scope=web
- name: Build and push worker image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf
with:
context: packages/worker
file: packages/worker/Dockerfile
push: true
tags: |
${{ env.WORKER_IMAGE }}:${{ github.sha }}
${{ env.WORKER_IMAGE }}:latest
cache-from: type=gha,scope=worker
cache-to: type=gha,mode=min,scope=worker
- name: Output image digests
run: |
echo "Web image: $WEB_IMAGE:${{ github.sha }}"
echo "Worker image: $WORKER_IMAGE:${{ github.sha }}"