-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (68 loc) · 2.65 KB
/
docker.yml
File metadata and controls
75 lines (68 loc) · 2.65 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
75
name: docker
on:
push:
branches: [ main, develop ]
tags: "v[0-9]+.[0-9]+.[0-9]+"
jobs:
docker:
strategy:
matrix:
include:
- dockerFilename: Dockerfile
imageName: ktwrd/xenia-discord
- dockerFilename: Dockerfile
imageName: ghcr.io/ktwrd/xenia-discord
- dockerFilename: WebPanel.Dockerfile
imageName: ktwrd/xenia-discord-dash
- dockerFilename: WebPanel.Dockerfile
imageName: ghcr.io/ktwrd/xenia-discord-dash
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set Environment Variables
run: |
echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "CONTAINER_VERSION=$(git describe --tags --abbrev=0).$([[ $GITHUB_REF = refs/tags/* ]] && echo 0 || echo 65534)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "BUILD_DATE=$(date --iso-8601=s)" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build and push (dev, ${{ matrix.imageName }}, ${{ matrix.dockerFilename }})'
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/develop'
with:
push: true
tags: |
${{ matrix.imageName }}:dev
${{ matrix.imageName }}:latest
${{ matrix.imageName }}:dev-${{ env.CONTAINER_VERSION }}
${{ matrix.imageName }}:latest-${{ env.CONTAINER_VERSION }}
file: ${{ matrix.dockerFilename }}
- name: 'Build and push (stable, ${{ matrix.imageName }}, ${{ matrix.dockerFilename }})'
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
push: true
tags: |
${{ matrix.imageName }}:${{ env.TAG }}
${{ matrix.imageName }}:${{ env.CONTAINER_VERSION }}
${{ matrix.imageName }}:stable
${{ matrix.imageName }}:stable-${{ env.CONTAINER_VERSION }}
file: ${{ matrix.dockerFilename }}