Switch all Lix install actions #122
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - src/**/**.cs | |
| - src/**/*.csproj | |
| - src/**/package.nix | |
| - src/**/deps.json | |
| - src/**/Dockerfile | |
| - src/Dashboard/Pages/*.cshtml | |
| - default.nix | |
| - lon.nix | |
| - lon.lock | |
| - .github/workflows/build.yml | |
| workflow_dispatch: | |
| jobs: | |
| Build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Lix | |
| uses: canidae-solutions/lix-quick-install-action@v3 | |
| - name: Install Cachix | |
| uses: cachix/cachix-action@v16 | |
| with: | |
| name: drakon64 | |
| authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
| - name: Build | |
| run: cachix watch-exec drakon64 -- nix-build -A repository.docker -A dashboard.docker -A client | |
| - name: Upload to Cachix | |
| run: cachix push drakon64 $(nix eval --file default.nix --raw repository.docker) $(nix eval --file default.nix --raw dashboard.docker) $(nix eval --file default.nix --raw client) | |
| - name: Create Cachix pins | |
| run: | | |
| cachix pin drakon64 anamnesis "$(nix eval --file default.nix --raw repository.docker)" --keep-revisions 1 | |
| cachix pin drakon64 anamnesis-dashboard "$(nix eval --file default.nix --raw dashboard.docker)" --keep-revisions 1 | |
| cachix pin drakon64 anamnesis-client "$(nix eval --file default.nix --raw client)" --keep-revisions 1 | |
| - run: | | |
| docker load < result | |
| docker load < result-2 | |
| - name: Login to GitHub Packages | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Repository to GitHub Packages | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: src/Repository | |
| push: true | |
| tags: ghcr.io/drakon64/anamnesis:latest | |
| env: | |
| SOURCE_DATE_EPOCH: 0 | |
| - name: Upload Dashboard to GitHub Packages | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: src/Dashboard | |
| push: true | |
| tags: ghcr.io/drakon64/anamnesis-dashboard:latest | |
| env: | |
| SOURCE_DATE_EPOCH: 0 | |
| Deploy: | |
| needs: | |
| - Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Lix | |
| uses: canidae-solutions/lix-quick-install-action@v3 | |
| - name: Install Cachix | |
| uses: cachix/cachix-action@v16 | |
| with: | |
| name: drakon64 | |
| authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
| - name: Build Nix shell | |
| run: nix-shell -A opentofu --run "exit" | |
| - uses: google-github-actions/auth@v3 | |
| with: | |
| project_id: ${{ secrets.GCP_PROJECT }} | |
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
| - name: Deploy to Cloud Run | |
| run: | | |
| echo "$TERRAFORM_TFVARS" | base64 -d > terraform.tfvars | |
| nix-shell -A opentofu ../shell.nix --run "tofu init" | |
| nix-shell -A opentofu ../shell.nix --run "tofu apply -auto-approve -target 'module.anamnesis.google_cloud_run_v2_service.dashboard[\"europe-west1\"]' -target 'module.anamnesis.google_cloud_run_v2_service.dashboard[\"europe-west4\"]' -target 'module.anamnesis.google_cloud_run_v2_service.repository[\"europe-west1\"]' -target 'module.anamnesis.google_cloud_run_v2_service.repository[\"europe-west4\"]'" | |
| working-directory: tofu | |
| env: | |
| TERRAFORM_TFVARS: ${{ secrets.TERRAFORM_TFVARS }} |