2023-01-01 00:01:07 +00:00
|
|
|
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:
|
2023-12-18 21:50:33 +00:00
|
|
|
- uses: actions/checkout@v4.1.1
|
2023-01-01 00:01:07 +00:00
|
|
|
|
2023-12-18 21:50:33 +00:00
|
|
|
- uses: DeterminateSystems/nix-installer-action@v9
|
2023-03-05 18:05:11 +00:00
|
|
|
continue-on-error: true # Self-hosted runners already have Nix installed
|
2023-01-01 00:01:07 +00:00
|
|
|
|
2023-01-03 05:12:56 +00:00
|
|
|
- name: Install Attic
|
|
|
|
run: ./.github/install-attic-ci.sh
|
|
|
|
|
|
|
|
- name: Configure Attic
|
|
|
|
run: |
|
2023-01-03 06:44:31 +00:00
|
|
|
export PATH=$HOME/.nix-profile/bin:$PATH # FIXME
|
2023-01-03 05:12:56 +00:00
|
|
|
attic login staging https://staging.attic.rs/ "$ATTIC_TOKEN"
|
|
|
|
attic use attic-ci
|
|
|
|
env:
|
|
|
|
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
|
|
|
|
|
2023-01-01 00:01:07 +00:00
|
|
|
- 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
|
2023-12-18 21:50:33 +00:00
|
|
|
uses: actions/upload-pages-artifact@v2.0.0
|
2023-01-01 00:01:07 +00:00
|
|
|
with:
|
|
|
|
path: public
|
|
|
|
|
|
|
|
- name: Deploy book
|
2023-12-18 21:50:33 +00:00
|
|
|
uses: actions/deploy-pages@v3.0.1
|
2023-01-03 05:12:56 +00:00
|
|
|
|
|
|
|
# TODO: Just take a diff of the list of store paths, also abstract all of this out
|
|
|
|
- name: Push build artifacts
|
|
|
|
run: |
|
2023-01-03 06:44:31 +00:00
|
|
|
export PATH=$HOME/.nix-profile/bin:$PATH # FIXME
|
2023-01-03 05:12:56 +00:00
|
|
|
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 }}
|