1+ name : Docker (manual)
2+
3+ # This workflow uses actions that are not certified by GitHub.
4+ # They are provided by a third-party and are governed by
5+ # separate terms of service, privacy policy, and support
6+ # documentation.
7+
8+ on :
9+ workflow_dispatch :
10+ inputs :
11+ input_year :
12+ description : " Year (YYYY) version of TexLive, default of `latest`"
13+ required : false
14+ default : latest
15+ input_variant :
16+ description : " Ubuntu version (noble:24.04 LTS, jammy:22.04 LTS, focal:20.04 LTS) (use jammy on local arm64/Apple Silicon)"
17+ type : choice
18+ options :
19+ - noble
20+ - jammy
21+ - focal
22+
23+ env :
24+ # Use docker.io for Docker Hub if empty
25+ REGISTRY : ghcr.io
26+ # github.repository as <account>/<repo>
27+ IMAGE_NAME : ${{ github.repository_owner }}/latex # ${{ github.repository }}
28+ # Default value of matrix
29+ SCHEME_DEFAUTL : full
30+ VARIANT_DEFAUTL : jammy
31+
32+
33+ jobs :
34+ build :
35+
36+ runs-on : ubuntu-latest
37+ permissions :
38+ contents : read
39+ packages : write
40+ # This is used to complete the identity challenge
41+ # with sigstore/fulcio when running outside of PRs.
42+ id-token : write
43+
44+ strategy :
45+ matrix :
46+ scheme : # https://tug.org/texlive/doc/texlive-en/texlive-en.html#x1-26025r8
47+ - full # a [ ] full scheme (everything)
48+ - medium # b [ ] medium scheme (small + more packages and languages)
49+ - small # c [ ] small scheme (basic + xetex, metapost, a few languages)
50+ - basic # d [ ] basic scheme (plain and latex)
51+ - minimal # e [ ] minimal scheme (plain only)
52+ - infraonly # f [ ] infrastructure-only scheme (no TeX at all)
53+ # - # g [ ] book publishing scheme (core LaTeX and add-ons)
54+ # - # h [ ] ConTeXt scheme
55+ # - # i [ ] GUST TeX Live scheme
56+ # - # j [ ] teTeX scheme (more than medium, but nowhere near full)
57+ # - # k [ ] custom selection of collections
58+ name : Build TeXLive [${{ matrix.scheme }}-${{ inputs.input_variant }}]
59+
60+ steps :
61+ - name : Checkout repository
62+ uses : actions/checkout@v4
63+
64+ # # Install the cosign tool except on PR
65+ # # https://github.com/sigstore/cosign-installer
66+ # - name: Install cosign
67+ # if: github.event_name != 'pull_request'
68+ # uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
69+ # with:
70+ # cosign-release: 'v2.1.1'
71+
72+ # Set up BuildKit Docker container builder to be able to build
73+ # multi-platform images and export cache
74+ # https://github.com/docker/setup-buildx-action
75+ - name : Set up Docker Buildx
76+ uses : docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
77+
78+ # Login against a Docker registry except on PR
79+ # https://github.com/docker/login-action
80+ - name : Log into registry ${{ env.REGISTRY }}
81+ if : github.event_name != 'pull_request'
82+ uses : docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
83+ with :
84+ registry : ${{ env.REGISTRY }}
85+ username : ${{ github.actor }}
86+ password : ${{ secrets.GITHUB_TOKEN }}
87+
88+ # Obtain TeXLive year version
89+ - name : Obtain TeXLive year version
90+ id : year
91+ run : |
92+ if [ "${{ inputs.input_year }}" = "" ] || [ "${{ inputs.input_year }}" = "latest" ]; then \
93+ wget --no-check-certificate https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \
94+ zcat < install-tl-unx.tar.gz | tar -xf -; \
95+ echo "TEXLIVE_YEAR=$(ls -d install-tl-2* | cut -c 12-15)" >> $GITHUB_ENV; \
96+ echo "TEXLIVE_YEAR=$(ls -d install-tl-2* | cut -c 12-15)"; \
97+ else \
98+ echo "TEXLIVE_YEAR=${{ inputs.input_year }}" >> $GITHUB_ENV; \
99+ echo "TEXLIVE_YEAR=${{ inputs.input_year }}"; \
100+ fi
101+
102+ # Extract metadata (tags, labels) for Docker
103+ # https://github.com/docker/metadata-action
104+ - name : Extract Docker metadata
105+ id : meta
106+ uses : docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
107+ with :
108+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
109+ labels : |
110+ org.opencontainers.image.title=LaTeX
111+ tags : |
112+ type=schedule,pattern={{date 'YYYYMM'}},enable=${{ inputs.input_variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }}
113+ type=ref,event=branch,enable=${{ inputs.input_variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }}
114+ type=ref,event=tag,enable=${{ inputs.input_variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }}
115+ type=ref,event=pr
116+
117+ type=raw,enable=${{ env.TEXLIVE_YEAR=='latest' }},value=${{ matrix.scheme }}-${{ inputs.input_variant }}
118+ type=raw,enable=${{ env.TEXLIVE_YEAR=='latest' }},value=latest-${{ matrix.scheme }}-${{ inputs.input_variant }}
119+ type=raw,enable=true,value=${{ env.TEXLIVE_YEAR }}-${{ matrix.scheme }}-${{ inputs.input_variant }}
120+
121+ type=raw,enable=${{ inputs.input_variant==env.VARIANT_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=${{ matrix.scheme }}
122+ type=raw,enable=${{ inputs.input_variant==env.VARIANT_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=latest-${{ matrix.scheme }}
123+ type=raw,enable=${{ inputs.input_variant==env.VARIANT_DEFAUTL }},value=${{ env.TEXLIVE_YEAR }}-${{ matrix.scheme }}
124+ type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=${{ inputs.input_variant }}
125+ type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=latest-${{ inputs.input_variant }}
126+ type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL }},value=${{ env.TEXLIVE_YEAR }}-${{ inputs.input_variant }}
127+
128+ type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=latest
129+ type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }},value=${{ env.TEXLIVE_YEAR }}
130+
131+ # Build and push Docker image with Buildx (don't push on PR)
132+ # https://github.com/docker/build-push-action
133+ - name : Build and push Docker image
134+ id : build-and-push-latest
135+ uses : docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
136+ if : ${{ !(matrix.scheme == 'full' && github.event_name == 'pull_request') }}
137+ with :
138+ context : .
139+ file : Dockerfile
140+ push : ${{ github.event_name != 'pull_request' }}
141+ tags : ${{ steps.meta.outputs.tags }}
142+ build-args : |
143+ TEXLIVE_YEAR=${{ env.TEXLIVE_YEAR }}
144+ SCHEME=${{ matrix.scheme }}
145+ VARIANT=${{ inputs.input_variant }}
146+ labels : ${{ steps.meta.outputs.labels }}
147+ cache-from : type=gha
148+ cache-to : type=gha,mode=max
149+
150+ # # Sign the resulting Docker image digest except on PRs.
151+ # # This will only write to the public Rekor transparency log when the Docker
152+ # # repository is public to avoid leaking data. If you would like to publish
153+ # # transparency data even for private images, pass --force to cosign below.
154+ # # https://github.com/sigstore/cosign
155+ # - name: Sign the published Docker image
156+ # if: ${{ github.event_name == 'workflow_dispatch' }}
157+ # env:
158+ # # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
159+ # TAGS: ${{ steps.meta.outputs.tags }}
160+ # DIGEST: ${{ steps.build-and-push.outputs.digest }}
161+ # # This step uses the identity token to provision an ephemeral certificate
162+ # # against the sigstore community Fulcio instance.
163+ # run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
164+
0 commit comments