Skip to content

Commit 4563047

Browse files
committed
ci(action): add manual workflow
1 parent 8eda541 commit 4563047

File tree

3 files changed

+203
-52
lines changed

3 files changed

+203
-52
lines changed

.github/workflows/docker-publish.yml renamed to .github/workflows/docker-publish-latest.yml

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker
1+
name: Docker (latest)
22

33
# This workflow uses actions that are not certified by GitHub.
44
# They are provided by a third-party and are governed by
@@ -14,19 +14,14 @@ on:
1414
# Publish semver tags as releases.
1515
tags: [ 'v*.*.*' ]
1616
paths:
17-
- '.github/workflows/docker-publish.yml'
17+
- '.github/workflows/docker-publish-latest.yml'
1818
- 'Dockerfile'
1919
pull_request:
2020
branches: [ "main" ]
2121
paths:
22-
- '.github/workflows/docker-publish.yml'
22+
- '.github/workflows/docker-publish-latest.yml'
2323
- 'Dockerfile'
2424
workflow_dispatch:
25-
inputs:
26-
input_year:
27-
description: "Year (YYYY) version of TexLive, default of `latest`"
28-
required: false
29-
default: latest
3025

3126
env:
3227
# Use docker.io for Docker Hub if empty
@@ -64,6 +59,7 @@ jobs:
6459
# - # j [ ] teTeX scheme (more than medium, but nowhere near full)
6560
# - # k [ ] custom selection of collections
6661
variant:
62+
# - focal # 20.04 LTS
6763
- jammy # 22.04 LTS
6864
- noble # 24.04 LTS
6965
name: Build TeXLive [${{ matrix.scheme }}-${{ matrix.variant }}]
@@ -100,19 +96,10 @@ jobs:
10096
- name: Obtain TeXLive year version
10197
id: year
10298
run: |
103-
if [ "${{ github.event_name }}" != "workflow_dispatch" ] || [ "${{ inputs.input_year }}" = "latest" ]; then \
104-
echo "TEXLIVE_YEAR=latest" >> $GITHUB_ENV; \
105-
echo "TEXLIVE_YEAR=latest"; \
106-
wget --no-check-certificate https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \
107-
zcat < install-tl-unx.tar.gz | tar -xf -; \
108-
echo "YEAR=$(ls -d install-tl-2* | cut -c 12-15)" >> $GITHUB_ENV; \
109-
echo "YEAR=$(ls -d install-tl-2* | cut -c 12-15)"; \
110-
else \
111-
echo "TEXLIVE_YEAR=${{ inputs.input_year }}" >> $GITHUB_ENV; \
112-
echo "TEXLIVE_YEAR=${{ inputs.input_year }}"; \
113-
echo "YEAR=${{ inputs.input_year }}" >> $GITHUB_ENV; \
114-
echo "YEAR=${{ inputs.input_year }}"; \
115-
fi
99+
wget --no-check-certificate https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
100+
zcat < install-tl-unx.tar.gz | tar -xf -
101+
echo "TEXLIVE_YEAR=$(ls -d install-tl-2* | cut -c 12-15)" >> $GITHUB_ENV
102+
echo "TEXLIVE_YEAR=$(ls -d install-tl-2* | cut -c 12-15)"
116103
117104
# Extract metadata (tags, labels) for Docker
118105
# https://github.com/docker/metadata-action
@@ -129,19 +116,19 @@ jobs:
129116
type=ref,event=tag,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }}
130117
type=ref,event=pr
131118
132-
type=raw,enable=${{ env.TEXLIVE_YEAR=='latest' }},value=latest-${{ matrix.scheme }}-${{ matrix.variant }}
133-
type=raw,enable=true,value=${{ env.YEAR }}-${{ matrix.scheme }}-${{ matrix.variant }}
134119
type=raw,enable=true,value=${{ matrix.scheme }}-${{ matrix.variant }}
120+
type=raw,enable=true,value=latest-${{ matrix.scheme }}-${{ matrix.variant }}
121+
type=raw,enable=true,value=${{ env.TEXLIVE_YEAR }}-${{ matrix.scheme }}-${{ matrix.variant }}
135122
136-
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=latest-${{ matrix.scheme }}
137-
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL }},value=${{ env.YEAR }}-${{ matrix.scheme }}
138123
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL }},value=${{ matrix.scheme }}
139-
type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=latest-${{ matrix.variant }}
140-
type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL }},value=${{ env.YEAR }}-${{ matrix.variant }}
124+
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL }},value=latest-${{ matrix.scheme }}
125+
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL }},value=${{ env.TEXLIVE_YEAR }}-${{ matrix.scheme }}
141126
type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL }},value=${{ matrix.variant }}
127+
type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL }},value=latest-${{ matrix.variant }}
128+
type=raw,enable=${{ matrix.scheme==env.SCHEME_DEFAUTL }},value=${{ env.TEXLIVE_YEAR }}-${{ matrix.variant }}
142129
143-
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL && env.TEXLIVE_YEAR=='latest' }},value=latest
144-
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }},value=${{ env.YEAR }}
130+
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }},value=latest
131+
type=raw,enable=${{ matrix.variant==env.VARIANT_DEFAUTL && matrix.scheme==env.SCHEME_DEFAUTL }},value=${{ env.TEXLIVE_YEAR }}
145132
146133
# Build and push Docker image with Buildx (don't push on PR)
147134
# https://github.com/docker/build-push-action
@@ -155,9 +142,9 @@ jobs:
155142
push: ${{ github.event_name != 'pull_request' }}
156143
tags: ${{ steps.meta.outputs.tags }}
157144
build-args: |
158-
VARIANT=${{ matrix.variant }}
145+
TEXLIVE_YEAR=latest
159146
SCHEME=${{ matrix.scheme }}
160-
TEXLIVE_YEAR=${{ env.TEXLIVE_YEAR }}
147+
VARIANT=${{ matrix.variant }}
161148
labels: ${{ steps.meta.outputs.labels }}
162149
cache-from: type=gha
163150
cache-to: type=gha,mode=max
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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+

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ docker pull ghcr.io/rnicrosoft-studio/latex:<TAG>
1616
| `<VARIANT>` | jammy |
1717

1818

19-
* `main` `jammy`
20-
* `latest` `latest-jammy`
21-
* `2024` `2024-jammy`
22-
* `full` `full-jammy`
23-
* `latest-full` `latest-full-jammy`
24-
* `2024-full` `2024-full-jammy`
25-
* `medium` `medium-jammy`
26-
* `latest-medium` `latest-medium-jammy`
27-
* `2024-medium` `2024-medium-jammy`
28-
* `small` `small-jammy`
29-
* `latest-small` `latest-small-jammy`
30-
* `2024-small` `2024-small-jammy`
31-
* `basic` `basic-jammy`
32-
* `latest-basic` `latest-basic-jammy`
33-
* `2024-basic` `2024-basic-jammy`
34-
* `minimal` `minimal-jammy`
35-
* `latest-minimal` `latest-minimal-jammy`
36-
* `2024-minimal` `2024-minimal-jammy`
37-
* `infraonly` `infraonly-jammy`
38-
* `latest-infraonly` `latest-infraonly-jammy`
39-
* `2024-infraonly` `2024-infraonly-jammy`
19+
* `noble` `jammy`
20+
* `latest` `latest-noble` `latest-jammy`
21+
* `2024` `2024-noble` `2024-jammy`
22+
* `full` `full-noble` `full-jammy`
23+
* `latest-full` `latest-full-noble` `latest-full-jammy`
24+
* `2024-full` `2024-full-noble` `2024-full-jammy`
25+
* `medium` `medium-noble` `medium-jammy`
26+
* `latest-medium` `latest-medium-noble` `latest-medium-jammy`
27+
* `2024-medium` `2024-medium-noble` `2024-medium-jammy`
28+
* `small` `small-noble` `small-jammy`
29+
* `latest-small` `latest-small-noble` `latest-small-jammy`
30+
* `2024-small` `2024-small-noble` `2024-small-jammy`
31+
* `basic` `basic-noble` `basic-jammy`
32+
* `latest-basic` `latest-basic-noble` `latest-basic-jammy`
33+
* `2024-basic` `2024-basic-noble` `2024-basic-jammy`
34+
* `minimal` `minimal-noble` `minimal-jammy`
35+
* `latest-minimal` `latest-minimal-noble` `latest-minimal-jammy`
36+
* `2024-minimal` `2024-minimal-noble` `2024-minimal-jammy`
37+
* `infraonly` `infraonly-noble` `infraonly-jammy`
38+
* `latest-infraonly` `latest-infraonly-noble` `latest-infraonly-jammy`
39+
* `2024-infraonly` `2024-infraonly-noble` `2024-infraonly-jammy`
4040

4141
# Notice
4242

0 commit comments

Comments
 (0)