-
-
Notifications
You must be signed in to change notification settings - Fork 29
102 lines (89 loc) · 3.7 KB
/
monthly-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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 }}