-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (67 loc) · 1.86 KB
/
build-docker-workflow.yaml
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Docker build CI
on:
# for debug
# pull_request:
push:
branches: [ master ]
tags:
- "v*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
-
name: Build and push release
uses: docker/build-push-action@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
context: .
push: true
tags: ceobecanteen/ceobe-canteen-bot:${{ env.TAG_NAME }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false
-
name: Build and push latest
uses: docker/build-push-action@v4
if: "!startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push'"
with:
context: .
push: true
tags: ceobecanteen/ceobe-canteen-bot
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false
-
name: Build and push debug
uses: docker/build-push-action@v4
if: "github.event_name == 'pull_request'"
with:
context: .
push: true
tags: ceobecanteen/ceobe-canteen-bot:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
sbom: false