-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (37 loc) · 1.1 KB
/
main.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
name: Dockerfile Check
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * 0' # Run every Sunday at midnight
jobs:
check_dockerfile:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Build Docker Image
run: |
docker build -t my-docker-image .
- name: Test Docker Run
run: |
docker run --rm my-docker-image /bin/bash -c "echo 'Docker passed'"
- name: Set Badge Status
id: set-badge
run: |
status="Docker build passed"
if [ $? -ne 0 ]; then
status="Docker build failed"
fi
echo "Status=$status" >> $GITHUB_ENV
echo "Color=$([[ $status == 'Docker build passed' ]] && echo '00FF00' || echo 'FF0000')" >> $GITHUB_ENV
- name: Docker Badge
uses: RubbaBoy/BYOB@v1.3.0
with:
NAME: docker-badge
LABEL: 'Docker Status'
ICON: 'docker'
STATUS: ${{ env.Status }}
COLOR: ${{ env.Color }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}