ci: Deploy docs using nix (not docker) #1040
Workflow file for this run
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: "CI" | |
on: | |
push: | |
branches: | |
- "master" | |
- ci-docs-nix | |
pull_request: | |
jobs: | |
nix: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
# TODO: Disablig x86_64-linux for now, as it is causing qemu segfault. | |
# Fix treefmt check causing qemu segfault: https://nixos.zulipchat.com/#narrow/stream/413948-nixos/topic/QEMU.20internal.20SIGSEGV | |
system: [aarch64-linux, aarch64-darwin] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Nix | |
run: | | |
nixci --build-systems "github:nix-systems/${{ matrix.system }}" | |
- name: Check closure size | |
run: | | |
# TODO: Check on all platforms? | |
nix run .#check-closure-size | |
- name: Docs | |
id: docs | |
if: matrix.system == 'aarch64-linux' | |
run: | | |
nix build .#docs -o docs-static | |
- name: Deploy docs to gh-pages 🚀 | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs-static | |
cname: emanote.srid.ca | |
docker-build: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build as docker img | |
id: build | |
run: | | |
nix build -j auto -o docker-img .#packages.x86_64-linux.dockerImage | |
# docker | |
export DOCKERIMG=$(readlink ./docker-img) | |
echo "::set-output name=docker-img::${DOCKERIMG}" | |
- name: Upload docker image tgz | |
uses: actions/upload-artifact@v4 | |
if: github.ref == 'refs/heads/master' | |
with: | |
name: docker-img | |
retention-days: 1 | |
path: | | |
${{ steps.build.outputs.docker-img }} | |
docker-push: | |
needs: docker-build | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
env: | |
DOCKERTAG: latest | |
steps: | |
- name: Download docker img | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-img | |
- name: Load Docker img | |
run: | | |
docker load -i *docker-image-emanote.tar.gz | |
- name: Publish Docker image to Docker Hub | |
run: | | |
echo ${{ secrets.DOCKER_PASS }} | docker login -u sridca --password-stdin | |
set -x | |
docker push sridca/emanote:latest |