-
Notifications
You must be signed in to change notification settings - Fork 32
47 lines (38 loc) · 1.1 KB
/
build.yml
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
name: Build
on:
# Trigger the workflow on push to main branch
push:
branches:
- main
workflow_run:
workflows: ["Test"]
branches: [main]
types:
- completed
env:
REGISTRY: ghcr.io
jobs:
# Build docker images with docker compose and push to github registry
build-push-to-registry:
name: Docker compose build and push to ghcr
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment:
name: prod
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create env file
run: |
touch .env
echo "${{ secrets.SERVER_ENV_PROD }}" > .env
- name: Build images
run: docker compose -f docker-compose.prod.yml build
- name: Push image to container registry
run: docker compose -f docker-compose.prod.yml push