texlive-2024-buster #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build Final Image | |
run-name: texlive-${{ inputs.year }}-${{ inputs.base_os }} | |
on: | |
workflow_dispatch: | |
inputs: | |
year: | |
required: true | |
description: texlive year | |
default: 2024 | |
type: number | |
base_os: | |
required: true | |
description: base os image | |
default: trixie | |
type: string | |
latest: | |
required: true | |
description: This is latest release | |
default: true | |
type: boolean | |
arm64: | |
required: false | |
description: Also build arm64 image | |
default: false | |
type: boolean | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.year }}-${{ inputs.base_os }} | |
cancel-in-progress: true | |
permissions: write-all | |
jobs: | |
build: | |
name: Build ${{inputs.year}} on ${{ inputs.base_os }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Maximize build space | |
run: | | |
# Remove .Net | |
sudo rm -rf /usr/share/dotnet | |
# Remove Android | |
sudo rm -rf /usr/local/lib/android | |
# Remove Haskell | |
sudo rm -rf /opt/ghc | |
# Remove CodeQL | |
sudo rm -rf /opt/hostedtoolcache/CodeQL | |
# Remove docker images | |
sudo docker image prune --all --force | |
- name: Set up Git repository | |
uses: actions/checkout@main | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@master | |
- name: Login to DockerHub | |
uses: docker/login-action@master | |
with: | |
username: zydou | |
password: ${{ secrets.DOCKER_PASSWD }} | |
- name: Login to ACR | |
uses: docker/login-action@master | |
with: | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWD }} | |
registry: ${{ secrets.ACR_REGISTRY }} | |
- name: Set latest image tags | |
if: inputs.latest | |
run: | | |
if [ "${{inputs.base_os}}" = "trixie" ]; then | |
echo "TAGS=zydou/texlive:latest,zydou/texlive:latest-${{inputs.base_os}},zydou/texlive:${{inputs.year}},zydou/texlive:${{inputs.base_os}},zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
echo "ACR_TAGS=${{secrets.ACR_REGISTRY}}/zydou/texlive:latest,${{secrets.ACR_REGISTRY}}/zydou/texlive:latest-${{inputs.base_os}},${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.year}},${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.base_os}},${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
else | |
echo "TAGS=zydou/texlive:latest-${{inputs.base_os}},zydou/texlive:${{inputs.base_os}},zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
echo "ACR_TAGS=${{secrets.ACR_REGISTRY}}/zydou/texlive:latest-${{inputs.base_os}},${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.base_os}},${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
fi | |
- name: Set image tags | |
if: inputs.latest == 0 | |
run: | | |
if [ "${{inputs.base_os}}" = "trixie" ]; then | |
echo "TAGS=zydou/texlive:${{inputs.year}},zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
echo "ACR_TAGS=${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.year}},${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
else | |
echo "TAGS=zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
echo "ACR_TAGS=${{secrets.ACR_REGISTRY}}/zydou/texlive:${{inputs.year}}-${{inputs.base_os}}" >> "${GITHUB_ENV}" | |
fi | |
- name: Build and push (with arm64) | |
if: inputs.arm64 | |
uses: docker/build-push-action@master | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
provenance: false | |
build-args: | | |
YEAR=${{inputs.year}} | |
BASE_OS=${{inputs.base_os}} | |
cache-from: type=registry,ref=zydou/texlive:cache-${{inputs.year}}-${{inputs.base_os}} | |
cache-to: type=registry,ref=zydou/texlive:cache-${{inputs.year}}-${{inputs.base_os}},mode=max | |
tags: | | |
${{ env.TAGS }} | |
${{ env.ACR_TAGS }} | |
- name: Build and push (no arm64) | |
if: inputs.arm64 == 0 | |
uses: docker/build-push-action@master | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64 | |
push: true | |
provenance: false | |
build-args: | | |
YEAR=${{inputs.year}} | |
BASE_OS=${{inputs.base_os}} | |
cache-from: type=registry,ref=zydou/texlive:cache-${{inputs.year}}-${{inputs.base_os}} | |
cache-to: type=registry,ref=zydou/texlive:cache-${{inputs.year}}-${{inputs.base_os}},mode=max | |
tags: | | |
${{ env.TAGS }} | |
${{ env.ACR_TAGS }} | |
- name: Test | |
run: |- | |
docker run --rm zydou/texlive:${{inputs.year}}-${{inputs.base_os}} pdflatex --version | |
cat <<EOF >test.tex | |
\documentclass{article} | |
\usepackage{amsfonts} | |
\begin{document} | |
test | |
\end{document} | |
EOF | |
docker run --rm -v "$(pwd)":/data -w /data zydou/texlive:${{inputs.year}}-${{inputs.base_os}} pdflatex test.tex | |
file test.pdf | grep -q ' PDF ' |