-
Notifications
You must be signed in to change notification settings - Fork 23
65 lines (57 loc) · 1.84 KB
/
regenerate-images.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
name: Regenerate Images
on:
workflow_dispatch: {}
schedule:
# Once per week on sunday
- cron: '0 0 * * 0'
permissions:
packages: write
jobs:
preview-image:
runs-on: ubuntu-latest
env:
START_VERSION: 11
IMAGE_REPO: ghcr.io/${{ github.repository }}/showcase
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
fetch-tags: true
- uses: ./.github/actions/setup-mint
- name: Regenerate latest container images to keep them up to date
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
majorVersion=$START_VERSION
echo "Starting image regeneration with version $majorVersion"
while : ; do
version=$(git tag --sort=v:refname -l "$majorVersion.*.*" | tail -1)
[[ "$version" != "" ]] || break
image="$IMAGE_REPO:$version"
echo ""
echo "Regenerating $image"
echo ""
(( $majorVersion < 13 )) && target=initless || target=init
docker build \
--tag tmp-fat \
--build-arg BASE="$image" \
--file .github/Dockerfile.regenerate \
--target $target \
.
# Try/Catch
{
mint slim \
--target tmp-fat \
--tag tmp \
--preserve-path /usr/share/nginx/html
} || {
docker tag tmp-fat tmp
}
docker tag tmp "$image"
docker push "$image"
echo ""
echo "Finished regenerating $image"
echo ""
majorVersion=$((majorVersion+1))
done
env:
DOCKER_BUILDKIT: 1