Skip to content

Publish Monthly Release #36

Publish Monthly Release

Publish Monthly Release #36

on:
# Manual trigger mainly to create patch version
workflow_dispatch:
inputs:
patch_version:
description: 'Set the day of the patch version to create (i.e., z in x.y.z), so we could release patch versions like 2020.09.19 when necessary'
required: false
type: string
publish_choco:
description: 'Should we publish choco version'
required: true
type: boolean
default: false
# Monthly release
schedule:
- cron: '23 7 1 * *'
name: Publish Monthly Release
jobs:
build-linux:
runs-on: ubuntu-latest
name: Publish Montly release
env:
TINYTEX_INSTALLER: TinyTeX
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
steps:
- name: Clone repo
uses: actions/checkout@v4
with:
# needed to get the tags
fetch-depth: 0
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Current tag to target
run: |
# Are we making a patch version ?
patch_version=${{ github.event.inputs.patch_version }}
[ ! -z $patch_version ] && patch_version="."$patch_version
# if so, append to usual montly number
current_tag="$(date '+%Y.%m')${patch_version}"
tinytex_release="v${current_tag}"
echo "current dated tag is $current_tag"
echo "tinytex release tag will be $tinytex_release"
# if the tag exist, we fail
if [ $(git tag -l "${tinytex_release}") ]; then
echo "::error::Tag already ${tinytex_release} exist"
exit 1
fi
echo "CURRENT_TAG=$current_tag" >> $GITHUB_ENV
echo "TINYTEX_RELEASE=$tinytex_release" >> $GITHUB_ENV
- name: Create download directory
run: |
mkdir ${{ runner.temp }}/tinytex-bundles
- name: Download TinyTeX from daily release
working-directory: ${{ runner.temp }}/tinytex-bundles
run: |
gh release download daily
rm -f regex.tar.gz
rm -f TinyTeX-2* # do not release the full TeX Live bundle
# calculate md5sum of TinyTeX-1.zip for chocolatey
echo "TINYTEX_MD5SUM=$(md5sum TinyTeX-1.zip | cut -d' ' -f1)" >> $GITHUB_ENV
# rename files adding version
for f in TinyTeX*; do mv $f $(echo "$f" | sed "s/^TinyTeX[^.]*/&-${TINYTEX_RELEASE}/"); done
mv installer-unix.tar.gz install-unix-${TINYTEX_RELEASE}.tar.gz
- name: Update chocolatey package info
run: |
sed -i -E "s|(\s*<version>)([0-9.]+)(</version>\s*)|\1${CURRENT_TAG}\3|" choco/tinytex.nuspec
sed -i -E "s|(\s*checksum\s*=\s*')([^']*)('\\s*)|\1${TINYTEX_MD5SUM}\3|" choco/tools/chocolateyinstall.ps1
sed -i -E "s|($version\s*=\s*')([0-9.]+)('\s*)|\1${CURRENT_TAG}\3|" choco/tools/chocolateyinstall.ps1
git add -u
git diff-index --quiet HEAD && exit 0 || git commit -m"TinyTeX release v${CURRENT_TAG}"
- name: Create Git tag
run: |
git tag -f $TINYTEX_RELEASE
git push
git push -f --tags
- name: Create new Github release
run: |
gh release create $TINYTEX_RELEASE -F monthly-notes.md -t "TinyTeX $TINYTEX_RELEASE" ${{ runner.temp }}/tinytex-bundles/*
deploy-choco:
needs: [build-linux]
uses: ./.github/workflows/choco-package.yaml
with:
# if manually trigger, then we use the value from the inputs
publish: ${{ fromJSON( (github.event.inputs.publish_choco == '' && true) || github.event.inputs.publish_choco ) }}
secrets:
CHOCO_KEY: ${{ secrets.CHOCO_KEY }}