Skip to content

Commit 54a635b

Browse files
committed
Build action
1 parent 9f1084b commit 54a635b

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,51 @@
11
name: Build
2-
32
on:
4-
pull_request:
53
push:
64
branches:
7-
- main
5+
- 'master'
6+
tags:
7+
- 'v*.*.*'
8+
pull_request:
9+
branches:
10+
- 'master'
811

912
jobs:
10-
build-cardinal:
11-
name: Cardinal
13+
build:
14+
name: Build
1215
runs-on: ubuntu-latest
13-
defaults:
14-
run:
15-
working-directory: ./cardinal
16+
env:
17+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
18+
DOCKER_REGISTRY: ghcr.io
19+
DOCKER_IMAGE_NAME: ${{ github.repository }}
1620
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v4
19-
- name: Setup Docker Build
20-
uses: docker/setup-buildx-action@v2
21-
- name: Build Cardinal Docker Image
22-
run: docker build .
21+
- name: Check out the repo
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v1
26+
27+
- name: Log in to the registry
28+
uses: docker/login-action@v1
29+
with:
30+
registry: ${{ env.DOCKER_REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
# Cardinal
35+
36+
- name: Cardinal image tags & labels
37+
id: meta-cardinal
38+
uses: docker/metadata-action@v3
39+
with:
40+
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}-cardinal
41+
42+
- name: Cardinal image build & push
43+
uses: docker/build-push-action@v2
44+
with:
45+
context: ./cardinal
46+
file: Dockerfile
47+
push: true
48+
cache-from: type=gha
49+
cache-to: type=gha,mode=max
50+
tags: ${{ steps.meta-cardinal.outputs.tags }}
51+
labels: ${{ steps.meta-cardinal.outputs.labels }}

0 commit comments

Comments
 (0)