-
Notifications
You must be signed in to change notification settings - Fork 2
73 lines (72 loc) · 2.15 KB
/
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
69
70
71
72
73
# This file was generated using Kotlin DSL (.github/workflows/docker_workflow.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/typesafegithub/github-workflows-kt
name: 'Docker build & push'
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
jobs:
check_yaml_consistency:
name: 'Check YAML consistency'
runs-on: 'ubuntu-latest'
steps:
- id: 'step-0'
name: 'Check out'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Execute script'
run: 'rm ''.github/workflows/docker_workflow.yaml'' && ''.github/workflows/docker_workflow.main.kts'''
- id: 'step-2'
name: 'Consistency check'
run: 'git diff --exit-code ''.github/workflows/docker_workflow.yaml'''
build_job:
name: 'Build Job'
runs-on: 'ubuntu-latest'
needs:
- 'check_yaml_consistency'
steps:
- id: 'step-0'
name: 'Check out'
uses: 'actions/checkout@v4'
with:
fetch-depth: '0'
- id: 'step-1'
name: 'Docker Login'
uses: 'docker/login-action@v3'
with:
username: '${{ secrets.DOCKER_HUB_USERNAME }}'
password: '${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}'
- id: 'step-2'
name: 'Docker Setup buildx'
uses: 'docker/setup-buildx-action@v3'
- id: 'step-3'
name: 'Build and push'
uses: 'docker/build-push-action@v5'
with:
context: '.'
file: './Dockerfile'
push: 'true'
tags: '${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest'
- id: 'step-4'
name: 'image digest'
run: 'echo ${{ steps.step-3.outputs.digest }}'
discord_notification:
name: 'Discord Notification'
runs-on: 'ubuntu-latest'
needs:
- 'build_job'
- 'check_yaml_consistency'
if: '${{ always() }}'
steps:
- id: 'step-0'
name: 'Discord Workflow Status Notifier'
uses: 'nobrayner/discord-webhook@v1'
with:
github-token: '${{ github.token }}'
discord-webhook: '${{ secrets.WEBHOOK_URL }}'
include-details: 'true'
if: 'always()'