-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (59 loc) · 1.83 KB
/
build_and_push_docker.yml
File metadata and controls
62 lines (59 loc) · 1.83 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
name: build and deploy docker
on:
workflow_call:
inputs:
latest:
description: "Tag as latest"
type: boolean
required: false
default: false
workflow_dispatch:
inputs:
latest:
description: "Tag as latest"
type: boolean
required: false
default: false
jobs:
build_docker_image:
name: build docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install Nix
uses: cachix/install-nix-action@v26
- name: build docker image
run: nix build .#dockerImage
- name: upload docker image
uses: actions/upload-artifact@v4
with:
name: docker_image
path: result
push_docker_image:
name: push docker image
runs-on: ubuntu-latest
needs: build_docker_image
steps:
- name: download docker_image artifact
uses: actions/download-artifact@v4
with:
name: docker_image
path: docker_image
- name: login to the container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: load docker build
run: docker load -i ${{ github.workspace }}/docker_image/result
- name: tag docker image
run: docker tag knowsql:${{ github.sha }} ghcr.io/gdwr/knowsql:${{ github.sha }}
- name: push docker image to ghcr
run: docker push ghcr.io/gdwr/knowsql:${{ github.sha }}
- name: tag docker image as latest
if: ${{ inputs.latest }}
run: docker tag ghcr.io/gdwr/knowsql:${{ github.sha }} ghcr.io/gdwr/knowsql:latest
- name: push docker image to ghcr as latest
if: ${{ inputs.latest }}
run: docker push ghcr.io/gdwr/knowsql:latest