-
Notifications
You must be signed in to change notification settings - Fork 20
79 lines (70 loc) · 2.52 KB
/
container-build.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
74
75
76
77
78
79
name: "🏗️ Container Image Build"
on:
pull_request:
branches:
- main
paths:
- container/**
push:
branches:
- main
paths:
- container/**
workflow_dispatch:
inputs:
publish:
type: boolean
default: false
required: true
description: "Push the image after the build?"
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install qemu dependency
run: |-
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Get Uptime-Kuma Version
run: |-
VERSION=`sed -nr "s;.*docker.io/louislam/uptime-kuma:(.*)-debian.*;\1;p" container/Containerfile`
echo "APP_VERSION=${VERSION}"
echo "APP_VERSION=${VERSION}" >> $GITHUB_ENV
- id: container
name: Build Container Image
uses: redhat-actions/buildah-build@b4dc19b4ba891854660ab1f88a097d45aa158f76 # v2.12
with:
image: uptime-kuma
tags: >-
latest
${{ env.APP_VERSION }}
oci: true
platforms: linux/amd64, linux/arm64, linux/arm/v7
containerfiles: |-
container/Containerfile
- name: Push container image to quay.io
if: ${{ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish)) && github.ref == 'refs/heads/main' }}
uses: redhat-actions/push-to-registry@9986a6552bc4571882a4a67e016b17361412b4df # v2.7
with:
image: ${{ steps.container.outputs.image }}
tags: ${{ steps.container.outputs.tags }}
registry: quay.io/k3rnel-pan1c
username: ${{ secrets.QUAY_USR }}
password: ${{ secrets.QUAY_PWD }}
- name: Push container image to ghcr.io
if: ${{ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish)) && github.ref == 'refs/heads/main' }}
uses: redhat-actions/push-to-registry@9986a6552bc4571882a4a67e016b17361412b4df # v2.7
with:
image: ${{ steps.container.outputs.image }}
tags: ${{ steps.container.outputs.tags }}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ github.token }}