forked from eritislami/evobot
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.67 KB
/
publish-docker.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
44
45
46
47
48
49
50
51
52
53
54
55
name: Publish Docker Image
on:
push:
branches:
- master # Trigger für Development-Builds
release:
types: [published] # Trigger für Release-Builds
jobs:
build-and-push:
#runs-on: ubuntu-latest
runs-on: self-hosted
steps:
# 1. Repository-Code auschecken
- name: Check out code
uses: actions/checkout@v3
# 2. Docker-Tags basierend auf dem Event setzen
- name: Set up Docker tags
id: vars
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "TAGS=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest" >> $GITHUB_ENV
else
echo "TAGS=ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:development" >> $GITHUB_ENV
fi
# 3. Bei GHCR einloggen
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 4. QEMU für Multiarch-Emulation einrichten
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
# 5. Docker Buildx einrichten
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# 6. Docker-Image bauen und pushen
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.TAGS }}
platforms: linux/amd64,linux/arm64