name: Archival
author: "Archival Team"
description: "Builds and publishes a local archival site"
branding:
icon: "archive"
color: "green"
inputs:
archival-bin:
description:
A path to an archival binary to run. If not provided, will run the version
from Cargo.toml.
required: false
archival-version:
description:
Override the archival version to use from cargo. If archival-bin is
specified, this does nothing.
required: false
default: "0.19.0"
api-host:
description: "API Host to send build events to"
required: false
default: "https://api.archival.dev"
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Install Archival
if: ${{ inputs.archival-bin == '' }}
shell: bash
env:
VERSION: ${{ inputs.archival-version }}
run: |
set -euo pipefail
dir="archival-v${VERSION}-x86_64-unknown-linux-musl"
base="https://github.com/jesseditson/archival/releases/download/v${VERSION}"
cd "$(mktemp -d)"
curl -fsSL --retry 3 -O "$base/$dir.tar.gz"
echo "$(curl -fsSL "$base/$dir.tar.gz.sha256") $dir.tar.gz" | sha256sum -c -
mkdir -p "$HOME/.local/bin"
tar xzf "$dir.tar.gz" -C "$HOME/.local/bin" --strip-components=1 "$dir/archival"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Set Build Dir
id: dist
run: echo "dist=$(${{ inputs.archival-bin || 'archival' }} manifest build_dir)" >> $GITHUB_OUTPUT
shell: bash
- name: Archival Prebuild
run: ${{ inputs.archival-bin || 'archival' }} prebuild
shell: bash
- name: Build with Archival
run: ${{ inputs.archival-bin || 'archival' }} build
shell: bash
- name: Get Build Size
id: size
run: echo "bytes=$(du -s dist | cut -f1)" >> $GITHUB_OUTPUT
shell: bash
- name: Limit Build Size
if: ${{ steps.size.outputs.bytes > 104857600 }}
run: |
echo "::error title={Artifact Too Big}::${{ steps.size.outputs.bytes }} exceeds maximum build size of 104857600 bytes"
exit 1
shell: bash
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
id: artifact
with:
name: ${{ github.sha }}
path: ${{ steps.dist.outputs.dist }}
if-no-files-found: error
retention-days: 1
overwrite: true
include-hidden-files: true
- name: Deploy
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
uses: fjogeleit/http-request-action@v1
with:
url: "${{ inputs.api-host }}/sync/${{ github.repository }}/${{ steps.artifact.outputs.artifact-id }}/${{ github.ref_name }}"
method: "PUT"