edit: update test #25
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: "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 |