forked from lissy93/web-check
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) Β· 1.87 KB
/
Copy pathdocker.yml
File metadata and controls
74 lines (63 loc) Β· 1.87 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
63
64
65
66
67
68
69
70
71
72
73
74
name: π³ Build + Publish Docker Image
on:
workflow_dispatch:
push:
branches:
- master
tags:
- '*'
paths:
- src/**
- api/**
- public/**
- Dockerfile
permissions:
contents: read
packages: write
env:
IMAGE_NAME: web-check
DOCKER_USER: sec-dan
GHCR_REGISTRY: ghcr.io
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout ποΈ
uses: actions/checkout@v6
- name: Extract tag name π·οΈ
shell: bash
run: echo "GIT_TAG=$(echo ${GITHUB_REF#refs/tags/} | sed 's/\//_/g')" >> $GITHUB_ENV
- name: Compute tags π
id: compute-tags
run: |
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
echo "GHCR_TAG=${GHCR_REGISTRY}/${DOCKER_USER}/${IMAGE_NAME}:latest" >> $GITHUB_ENV
else
echo "GHCR_TAG=${GHCR_REGISTRY}/${DOCKER_USER}/${IMAGE_NAME}:${GIT_TAG}" >> $GITHUB_ENV
fi
- name: Set up QEMU π§
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx π³
uses: docker/setup-buildx-action@v4
- name: Extract Docker metadata π·οΈ
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REGISTRY }}/${{ env.DOCKER_USER }}/${{ env.IMAGE_NAME }}
- name: Login to GitHub Container Registry π
uses: docker/login-action@v4
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker images π οΈ
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ env.GHCR_TAG }}