-
Notifications
You must be signed in to change notification settings - Fork 4
149 lines (128 loc) · 4.29 KB
/
docker.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Docker
on:
push:
branches:
- main
tags:
- v*
pull_request:
schedule:
- cron: '12 4 * * *'
# devel build
- cron: '13 4 * * *'
workflow_dispatch:
inputs:
date:
required: false
type: string
description: YYYYMMDD
push:
required: true
type: boolean
description: Push images
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare configuration
run: |
IMAGE_ID=${{ github.repository_owner }}/latex
if [[ "${{ github.event_name }}" == "schedule" && "${{ github.event.schedule }}" == "12 4 * * *" ]]; then
DATE=$(date '+%Y%m%d')
PUSH="true"
echo "Running scheduled build with date: $DATE"
elif [[ "${{ github.event_name }}" == "schedule" && "${{ github.event.schedule }}" == "13 4 * * *" ]]; then
PUSH="true"
VERSION=devel
MIRROR="https://texlive.info/CTAN/systems/texlive/tlnet"
echo "Running scheduled devel build"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ -n "${{ github.event.inputs.date }}" ]]; then
DATE="${{ github.event.inputs.date }}"
else
DATE=$(date '+%Y%m%d')
echo "No date supplied, using today's date"
fi
if [[ "${{ github.event.inputs.push }}" == "true" ]]; then
PUSH="true"
else
PUSH="false"
fi
echo "Running manual build with date: $DATE, push: $PUSH"
elif [[ "${{ github.ref }}" == "refs/tags/v"* ]]; then
PUSH="true"
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo $REF_NAME | sed -e 's/^v//')
VERSION_YEAR=$(echo $VERSION | sed -e 's/[^0-9].*//')
. MIRRORS
variable=TL_MIRROR_${VERSION_YEAR}
MIRROR=${!variable}
if [[ -z "$MIRROR" ]]; then
echo "Mirror not found for $VERSION_YEAR ($VERSION)"
exit 1
fi
echo "Running build for tag with version: $VERSION"
else
DATE=$(date '+%Y%m%d')
PUSH="false"
echo "Running test build with date: $DATE"
fi
# Will be re-tagged before push
echo "IMAGE_ID=image" | tee -a "$GITHUB_ENV"
echo "VERSION=version" | tee -a "$GITHUB_ENV"
echo "IMAGE_IDS=$IMAGE_ID ghcr.io/$IMAGE_ID" | tee -a "$GITHUB_ENV"
echo "PUSH=$PUSH" | tee -a "$GITHUB_ENV"
if [[ -n "$VERSION" ]]; then
echo "MIRROR=$MIRROR" | tee -a "$GITHUB_ENV"
echo "VERSIONS=$VERSION" | tee -a "$GITHUB_ENV"
else
./.github/workflows/configure_from_date.py "$DATE"
fi
- name: Build minimal
run: |
make minimal
- name: Build basic
run: |
make basic
- name: Run tests
run: |
make test
- name: Build small
if: env.PUSH == 'true'
run: |
make small
- name: Build medium
if: env.PUSH == 'true'
run: |
make medium
- name: Build full
if: env.PUSH == 'true'
run: |
make full
- name: Log in to DockerHub
uses: docker/login-action@v3
if: env.PUSH == 'true'
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
if: env.PUSH == 'true'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images
if: env.PUSH == 'true'
run: |
for image_id in $IMAGE_IDS; do
for version in $VERSIONS; do
for suffix in "-minimal" "-basic" "-small" "-medium" "-full" "" ; do
image=${image_id}:${version}${suffix}
echo "Tagging and pushing ${image}..."
docker tag ${{ env.IMAGE_ID }}:${{ env.VERSION }}${suffix} ${image}
docker push ${image}
done
done
done