forked from troeger/fuzzed
-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (78 loc) · 2.63 KB
/
main.yml
File metadata and controls
91 lines (78 loc) · 2.63 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
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Build
on:
pull_request:
push:
branches: [master]
tags:
- "*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_docker:
name: build docker
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Docker fe-meta
id: fe-meta
uses: docker/metadata-action@v4
env:
DOCKER_METADATA_PR_HEAD_SHA: true
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
tags: |
type=raw,value=${{ steps.extract_branch.outputs.branch }},enable=${{ github.ref != 'refs/heads/master' && steps.extract_branch.outputs.branch != '' }},prefix=fe-
type=semver,pattern={{raw}},prefix=fe-
type=raw,value=fe-latest,enable=${{ github.ref == 'refs/heads/master' }}
- name: Build and push fe
uses: docker/build-push-action@v4
with:
context: .
file: frontend/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.fe-meta.outputs.tags }}
platforms: linux/amd64
- name: Docker be-meta
id: be-meta
uses: docker/metadata-action@v4
env:
DOCKER_METADATA_PR_HEAD_SHA: true
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
tags: |
type=raw,value=${{ steps.extract_branch.outputs.branch }},enable=${{ github.ref != 'refs/heads/master' && steps.extract_branch.outputs.branch != '' }},prefix=be-
type=semver,pattern={{raw}},prefix=be-
type=raw,value=be-latest,enable=${{ github.ref == 'refs/heads/master' }}
- name: Build and push be
uses: docker/build-push-action@v4
with:
context: .
file: backends/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.be-meta.outputs.tags }}
platforms: linux/amd64