Nix CI #996
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
jobs: | |
_1_front: | |
name: Publish front | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v25 | |
with: | |
nix_conf: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = https://cache.nixos.org/ https://nix-community.cachix.org https://cache.iog.io https://deemp.cachix.org | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= deemp.cachix.org-1:9shDxyR2ANqEPQEEYDL/xIOnoPwxHot21L5fiZnFL18= | |
keep-outputs = true | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v1 | |
with: | |
key: nix-${{ runner.os }}-front-${{ hashfiles('**/flake.nix', '**/flake.lock') }} | |
linux-gc-enabled: true | |
linux-max-store-size: 900000000 | |
macos-gc-enabled: true | |
macos-max-store-size: 900000000 | |
restore-keys: | | |
nix-${{ runner.os }}-front- | |
- name: Build | |
run: |- | |
ROOT_DIR=$PWD | |
cd front | |
nix profile install .#buildGHPages | |
nix run .#buildGHPages | |
cd $ROOT_DIR | |
- name: GitHub Pages action | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
force_orphan: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./front/docs | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
_2_back: | |
name: Publish back | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v25 | |
with: | |
nix_conf: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
substituters = https://cache.nixos.org/ https://nix-community.cachix.org https://cache.iog.io https://deemp.cachix.org | |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= deemp.cachix.org-1:9shDxyR2ANqEPQEEYDL/xIOnoPwxHot21L5fiZnFL18= | |
keep-outputs = true | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v1 | |
with: | |
key: nix-${{ runner.os }}-back-${{ hashfiles('**/flake.nix', '**/flake.lock') }} | |
linux-gc-enabled: true | |
linux-max-store-size: 7000000000 | |
macos-gc-enabled: true | |
macos-max-store-size: 7000000000 | |
restore-keys: | | |
nix-${{ runner.os }}-back- | |
- name: Log in to Heroku | |
uses: AkhileshNS/heroku-deploy@master | |
with: | |
heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | |
heroku_app_name: try-phi-back | |
heroku_email: ${{ secrets.HEROKU_EMAIL }} | |
justlogin: true | |
- name: Release app on Heroku | |
run: |- | |
ROOT_DIR=$PWD | |
cd back | |
nix profile install .#herokuRelease | |
nix run .#herokuRelease | |
cd $ROOT_DIR | |
_3_purge_caches: | |
name: Purge cache | |
needs: | |
- _1_front | |
- _2_back | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Purge cache | |
uses: deemp/purge-cache@v1 | |
with: | |
accessed: true | |
created: true | |
debug: true | |
max-age: 172800 | |
name: Nix CI | |
"on": | |
pull_request: {} | |
push: {} | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: {} |