1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2025-03-05 08:17:05 +00:00
attic/.github/workflows/book.yml
2023-01-02 23:29:09 -07:00

63 lines
1.5 KiB
YAML

name: Deploy Book
on:
push:
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy-unstable:
name: Deploy
runs-on: ubuntu-latest
if: github.repository == 'zhaofengli/attic'
steps:
- uses: actions/checkout@v3.0.2
- name: Obtain current username
run: |
echo ACTION_USER=$USER >> $GITHUB_ENV
- uses: DeterminateSystems/nix-installer@main
with:
extra-conf: |
trusted-users = root ${{ env.ACTION_USER }}
- name: Install Attic
run: ./.github/install-attic-ci.sh
- name: Configure Attic
run: |
attic login staging https://staging.attic.rs/ "$ATTIC_TOKEN"
attic use attic-ci
env:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
- name: Build book
run: nix build .#book -L
- name: Copy book artifact
run: |
cp --recursive --dereference --no-preserve=mode,ownership result public
- name: Upload book artifact
uses: actions/upload-pages-artifact@v1.0.7
with:
path: public
- name: Deploy book
uses: actions/deploy-pages@v1.2.3
# TODO: Just take a diff of the list of store paths, also abstract all of this out
- name: Push build artifacts
run: |
if [ -n "$ATTIC_TOKEN" ]; then
nix build .#book --no-link --print-out-paths -L | \
xargs attic push attic-ci
fi
env:
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}