Skip to content

fix(ci): create releases with maintained action #292

fix(ci): create releases with maintained action

fix(ci): create releases with maintained action #292

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: Determine version
id: release-version
run: |
tag="${{ github.ref }}"
version="${tag##*/*-}"
is_prerelease=false
title="Release ${version}"
if [[ "${tag}" == *"/pre-"* ]]; then
is_prerelease=true
title="Pre-${title}"
fi
echo "version=${version}" >> $GITHUB_OUTPUT
echo "is_prerelease=${is_prerelease}" >> $GITHUB_OUTPUT
echo "title=${title}" >> $GITHUB_OUTPUT
- name: Assemble release notes
id: release-notes
run: |
.github/scripts/assemble-release-notes.sh \
"${IMAGE_TAG_LIST}" \
> release-notes.md
- name: Create Github release
id: create-gh-release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.release-version.outputs.title }}
body_path: release-notes.md
# TODO: mark as draft if created manually
prerelease: ${{ steps.release-version.outputs.is_prerelease }}