-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (67 loc) · 2.25 KB
/
publish.yml
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
name: "Publish to Typst package"
on:
push:
branches:
- main
- release-*
env:
GIT_USER_EMAIL: [email protected]
GIT_USER_NAME: HPDell
PACKAGE_NAME: cineca
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Typst Build
uses: typst-community/setup-typst@v3
- name: Install toml-cli
run: pip install toml-cli
- name: Copy to preview packages
run: |
export PKG_VERSION=`toml get --toml-path typst.toml "package.version"`
export PKG_PREVIEW_HOME="$HOME/.cache/typst/packages/preview/${{ env.PACKAGE_NAME }}/$PKG_VERSION/"
mkdir -p $PKG_PREVIEW_HOME
rsync -avP ./ $PKG_PREVIEW_HOME
- name: Test build example
working-directory: test
run: |
typst compile day-view.typ
typst compile month-summary.typ
typst compile month-view.typ
publish:
needs: [build]
if: startsWith(github.ref_name, 'release-')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clone packages repo
run: |
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
git config --global user.name "${{ env.GIT_USER_NAME }}"
git clone https://${{ env.GIT_USER_NAME }}:${{ secrets.GH_TOKEN }}@github.com/HPDell/typst-packages.git packages
- name: Get version number
run: |
pip install toml-cli
echo "PKG_VERSION=`toml get --toml-path typst.toml package.version`" >> "$GITHUB_ENV"
- name: Commit, merge and push
working-directory: packages
run: |
PKG_BRANCH="feat/${{ env.PACKAGE_NAME }}-$PKG_VERSION"
git switch -c $PKG_BRANCH
mkdir -p packages/preview/${{ env.PACKAGE_NAME }}/$PKG_VERSION
rsync -av \
--exclude=.git \
--exclude=.github \
--exclude=.gitignore \
--exclude=.vscode \
--exclude=packages \
../ \
packages/preview/${{ env.PACKAGE_NAME }}/$PKG_VERSION/
git add -A
git commit -m "${{ env.PACKAGE_NAME }}:$PKG_VERSION"
git push origin $PKG_BRANCH