CI #365
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_push_to_docker_hub_and_commit: | |
name: Push ${{ matrix.scriptName }} to Docker Hub | |
permissions: | |
actions: write | |
contents: write | |
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-ubuntu-22.04-${{ matrix.scriptName }}-${{ 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-ubuntu-22.04-${{ matrix.scriptName }}- | |
- name: Remove old cache profiles | |
run: rm -rf /nix/var/nix/profiles/cache | |
- name: Configure git for github-actions | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email github-actions@github.com | |
- name: Update flake locks | |
run: |- | |
nix profile install .#updateLocks | |
nix run .#updateLocks | |
- name: Format Nix files | |
run: |- | |
nix profile install .#format | |
nix run .#format | |
- env: | |
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
name: Push to Docker Hub | |
run: |- | |
nix profile install .#${{ matrix.scriptName }}PushToDockerHub | |
nix run .#${{ matrix.scriptName }}PushToDockerHub | |
- name: Generate server specification | |
run: |- | |
nix profile install .#genOpenAPI3 | |
nix run .#genOpenAPI3 | |
- env: | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
name: Write Docker image digests | |
run: |- | |
nix profile install .#writeDigests | |
nix run .#writeDigests | |
- name: Commit & Push | |
run: |- | |
git pull --rebase --autostash | |
git add . | |
git commit \ | |
-m "action" \ | |
-m "Update flake locks" \ | |
-m "Format Nix files" \ | |
-m "Generate server specification" \ | |
-m "Write Docker image digests" \ | |
|| echo "commit failed!" | |
git push | |
strategy: | |
matrix: | |
scriptName: | |
- back | |
- test | |
_2_build_deploy_gh_pages: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
name: Build and deploy GH Pages | |
needs: _1_push_to_docker_hub_and_commit | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: static | |
- id: deployment | |
name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v2 | |
name: CI | |
"on": | |
pull_request: {} | |
push: {} | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: {} | |
permissions: | |
actions: write | |
contents: write | |
id-token: write | |
pages: write |