generated from PrivateAIM/typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (64 loc) · 2.17 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
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
name: Create and publish Docker image
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
branches:
- '**'
pull_request:
branches: [ develop ]
jobs:
metadata:
runs-on: ubuntu-latest
outputs:
image_tags: ${{ steps.meta.outputs.tags }}
image_labels: ${{ steps.meta.outputs.labels }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Get Version
id: get-version
uses: beaconbrigade/[email protected]
with:
path: .
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=edge
type=raw,value=canary,enable=${{ contains(github.event.head_commit.message, 'build_image') }}
type=raw,value=latest,enable=${{ github.event.pull_request.merged == true }}
type=semver,pattern={{version}},value=${{ steps.get-version.outputs.version }},enable=${{ github.event.pull_request.merged == true || contains(github.event.head_commit.message, 'build_image') }}
build-prod-image:
if: ${{ github.event.pull_request.merged == true }}
uses: ./.github/workflows/build-docker-image.yaml
needs: [metadata]
with:
platforms: linux/amd64
docker_file: prod.Dockerfile
image_tags: ${{ needs.metadata.outputs.tags }}
image_labels: ${{ needs.metadata.outputs.labels }}
push: true
build-canary-image:
if: ${{ contains(github.event.head_commit.message, 'build_image') }}
uses: ./.github/workflows/build-docker-image.yaml
needs: [metadata]
with:
platforms: linux/amd64
docker_file: Dockerfile
image_tags: ${{ needs.metadata.outputs.tags }}
image_labels: ${{ needs.metadata.outputs.labels }}
push: true
build-edge-image:
uses: ./.github/workflows/build-docker-image.yaml
needs: [metadata]
with:
platforms: linux/amd64
docker_file: Dockerfile
image_tags: ${{ needs.metadata.outputs.image_tags }}
image_labels: ${{ needs.metadata.outputs.image_labels }}
push: true