-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (87 loc) · 2.72 KB
/
container.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: container
on:
schedule:
- cron: "0 10 * * *"
push:
branches:
- "main"
tags:
- "[0-9]+.*.*"
jobs:
container:
name: container
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu, debian ]
codename: [ latest ]
include:
- os: ubuntu
codename: noble
- os: ubuntu
codename: jammy
- os: ubuntu
codename: focal
- os: debian
codename: bullseye
- os: debian
codename: buster
steps:
- name: fixup variables
id: var-fixup
run: |
if test "${{ matrix.os }}" = "debian"; then
echo "CONTAINER=rust" >> $GITHUB_ENV
else
echo "CONTAINER=${{ matrix.os }}" >> $GITHUB_ENV
fi || true
if test "${{ matrix.codename }}" = "latest"; then
echo "TAG_SUFFIX=${{ matrix.os }}" >> $GITHUB_ENV
else
echo "TAG_SUFFIX=${{ matrix.codename }}" >> $GITHUB_ENV
fi || true
if test "${{ matrix.os }}" = "debian" -a "${{ matrix.codename }}" = "latest"; then
echo "LATEST=true" >> $GITHUB_ENV
else
echo "LATEST=false" >> $GITHUB_ENV
fi || true
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/kaspar030/git-cache
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=semver,pattern={{version}},latest={{ env.LATEST }}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
flavor: |
latest=auto
prefix=
suffix=-${{ env.TAG_SUFFIX }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ci/docker
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
DEBIAN_FROM=${{ env.CONTAINER }}:${{ matrix.codename }}
SOURCE=--git https://github.com/${{ github.repository }} --rev ${{ github.sha }}