Test & Publish #271
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: "Test & Publish" | |
on: | |
schedule: | |
- cron: '0 16 28 * *' | |
# Verify that (most) things work before running the monthly release. | |
push: | |
branches: | |
- 'master' | |
paths-ignore: | |
- '**.md' | |
- 'LICENSE' | |
- 'demo/**' | |
pull_request: | |
create: | |
workflow_dispatch: | |
env: | |
IMAGE_TAG_LIST: "texlive-image-tags" | |
TEXLIVE_INSTALLER_IMAGE: "texlive-installer:latest" | |
DOCKERHUB_USER_NAME: "reitzig" | |
jobs: | |
test-create-minimal: | |
name: "Test: Create Minimal Image" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Obtain Installer | |
run: .github/scripts/build-installer-image.sh | |
# TODO: Can the separate jobs share this image? | |
# TODO: build daily? and push to Github registry? (--> catch APK upgrades) | |
- name: "Build Test Image" | |
run: .github/scripts/build-image.sh ${GITHUB_REF} minimal | |
- name: "Test: Print version" | |
run: docker run --rm $(head -n 1 "${IMAGE_TAG_LIST}") version | |
test-run-examples: | |
name: "Test: Run Usage Examples" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Obtain Installer | |
run: .github/scripts/build-installer-image.sh | |
- name: "Build Test Image" | |
run: .github/scripts/build-image.sh ${GITHUB_REF} base-luatex | |
- name: "Test: One-off build" | |
run: .github/scripts/run-example.sh $(head -n 1 "${IMAGE_TAG_LIST}") one-off-build | |
- name: "Test: Repeated build" | |
run: .github/scripts/run-example.sh $(head -n 1 "${IMAGE_TAG_LIST}") repeated-build | |
- name: "Test: Complex build" | |
run: .github/scripts/run-example.sh $(head -n 1 "${IMAGE_TAG_LIST}") complex-build | |
- name: "Test: Interactive build" | |
run: .github/scripts/run-example.sh $(head -n 1 "${IMAGE_TAG_LIST}") interactive-build | |
- name: "Test: Custom Image" | |
run: .github/scripts/run-example.sh $(head -n 1 "${IMAGE_TAG_LIST}") custom-image | |
# TODO: Can we repeat the same step for different inputs? | |
# TODO: Split into separate jobs so they can be run in parallel? | |
publish-release: | |
name: Publish Images | |
runs-on: ubuntu-latest | |
needs: | |
- test-create-minimal | |
- test-run-examples | |
if: startsWith(github.ref, 'refs/tags/pre-') || startsWith(github.ref, 'refs/tags/release-') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Obtain Installer | |
run: .github/scripts/build-installer-image.sh | |
- name: Build images | |
run: | | |
for p in profiles/*; do | |
p=$(basename ${p}) | |
.github/scripts/build-image.sh ${GITHUB_REF} ${p%.profile} | |
done | |
- name: Publish images | |
# TODO: Use step output instead of a file? | |
# --> https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#set-an-output-parameter-set-output | |
run: | | |
docker login --username ${DOCKERHUB_USER_NAME} --password ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
while IFS= read -r tag; do | |
docker push "${tag}" | |
done <"${IMAGE_TAG_LIST}" | |
docker logout | |
- name: Create Github release | |
id: create-gh-release | |
uses: actions/create-release@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-') }} | |
# TODO: Compute release info before creating the release; communicate by step output | |
- name: Update Github release info | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
.github/scripts/update-github-release.sh \ | |
"${{ steps.create-gh-release.outputs.id }}" |