Skip to content

build(deps): bump actions/cache from 4 to 5 #12

build(deps): bump actions/cache from 4 to 5

build(deps): bump actions/cache from 4 to 5 #12

Workflow file for this run

name: Build hayagriva
on:
workflow_dispatch:
inputs:
ref:
description: The branch, tag or SHA in https://github.com/typst/hayagriva.
default: main
type: string
release:
description: Whether to publish artifacts in a new release.
default: false
type: boolean
pull_request:
paths:
- .github/workflows/hayagriva.yaml
# The following lines are based on GitHub docs, because typst/hayagriva does not build CLI.
# https://docs.github.com/en/actions/tutorials/build-and-test-code/rust
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ubuntu-latest
permissions:
contents: write
env:
INPUT_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || 'main' }}
INPUT_RELEASE: ${{ github.event_name == 'workflow_dispatch' && inputs.release || false }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
cargo: cross
- target: x86_64-pc-windows-msvc
cargo: cargo xwin
steps:
- uses: actions/checkout@v4
with:
repository: typst/hayagriva
ref: ${{ env.INPUT_REF }}
- uses: actions/checkout@v4
with:
path: dev-builds
- name: Report the revision
shell: bash
id: report
run: |
set -euxo pipefail
revision=$(python dev-builds/scripts/get_revision.py)
echo "Revision: $revision"
echo "revision=$revision" >> "$GITHUB_OUTPUT"
echo "Revision: \`$revision\`." >> "$GITHUB_STEP_SUMMARY"
- run: rustup target add ${{ matrix.target }}
- name: Cache cargo xwin
if: ${{ matrix.cargo == 'cargo xwin' }}
uses: actions/cache@v5
with:
path: |
~/.cache/cargo-xwin
key: |
${{ runner.os }}-cargo-xwin-${{ matrix.target }}
- name: Setup cargo xwin
if: ${{ matrix.cargo == 'cargo xwin' }}
run: |
pip install cargo-xwin
- name: Setup cross
if: ${{ matrix.cargo == 'cross' }}
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall cross --force # Even if cached, reinstall to set PATH properly.
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.target }}-hayagriva-${{ hashFiles('Cargo.toml') }}
# typst/hayagriva does not provide Cargo.lock.
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-hayagriva
${{ runner.os }}-cargo-${{ matrix.target }}
- name: Build
run: |
${{ matrix.cargo }} build --features cli --release --target ${{ matrix.target }}
- name: Prepare to upload
shell: bash
run: |
set -euxo pipefail
directory=hayagriva-${{ matrix.target }}
mkdir $directory
cp README.md LICENSE* $directory
if [ -f target/${{ matrix.target }}/release/hayagriva.exe ]; then
cp target/${{ matrix.target }}/release/hayagriva.exe $directory
7z a -r $directory.zip $directory
else
cp target/${{ matrix.target }}/release/hayagriva $directory
tar cJf $directory.tar.xz $directory
fi
- uses: actions/upload-artifact@v4
with:
name: hayagriva-${{ matrix.target }}
path: "hayagriva-${{ matrix.target }}.*"
- uses: softprops/action-gh-release@v2
if: ${{ env.INPUT_RELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.report.outputs.revision }}
name: ${{ steps.report.outputs.revision }}
draft: true
prerelease: false # can be edited in the Web UI
files: |
hayagriva-${{ matrix.target }}.*
- name: Report the release
if: ${{ env.INPUT_RELEASE == 'true' }}
run: |
echo "Please publish the [draft release](https://github.com/typst-community/dev-builds/releases)." >> "$GITHUB_STEP_SUMMARY"