Skip to content

Commit

Permalink
.github: Added attic configuration to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
aftix committed Oct 14, 2024
1 parent d770133 commit 65da72a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ jobs:
extra-trusted-public-keys = helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.thalheim.io-1:R7msbosLEZKrxk/lKxf9BTjOOH7Ax3H0Qj0/6wiHOgc= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE= attic-ci:U5Sey4mUxwBXM3iFapmP0/ogODXywKLRNgRPQpEXxbo=
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Configure attic
continue-on-error: true
run: |
echo ATTIC_CACHE=$ATTIC_CACHE >>$GITHUB_ENV
nix run 'github.com:zhaofengli/attic#attic-client' -- attic login --set-default ci "$ATTIC_SERVER" "$ATTIC_TOKEN"
nix run 'github.com:zhaofengli/attic#attic-client' -- attic use "$ATTIC_CACHE"
env:
ATTIC_SERVER: ${{ secrets.ATTIC_SERVER }}
ATTIC_CACHE: ${{ secrets.ATTIC_CACHE }}
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}

- name: Create ssh key from repository secrets
run: |
install -m 600 -D /dev/stdin ~/.ssh/id_ed25519 <<< "${{ secrets.PRIVATE_KEY }}"
Expand All @@ -48,7 +59,9 @@ jobs:

- name: Deploy fermi
run: |
nix run 'github.com:zhaofengli/attic#attic-client' -- attic watch-store "ci:$ATTIC_CACHE" &
nix run 'github:serokell/deploy-rs' '.#fermi' -- --ssh-user aftix -- --impure
kill %1
ssh [email protected] 'sh -ls' <<< "$SCRIPT"
env:
SCRIPT: >-
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,20 @@ jobs:
extra-trusted-substituters = https://helix.cachix.org https://cache.thalheim.io https://nix-community.cachix.org https://cache.garnix.io https://numtide.cachix.org https://staging.attic.rs/attic-ci
extra-trusted-public-keys = helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.thalheim.io-1:R7msbosLEZKrxk/lKxf9BTjOOH7Ax3H0Qj0/6wiHOgc= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE= attic-ci:U5Sey4mUxwBXM3iFapmP0/ogODXywKLRNgRPQpEXxbo=
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix flake check

- name: Configure attic
continue-on-error: true
run: |
echo ATTIC_CACHE=$ATTIC_CACHE >>$GITHUB_ENV
nix run 'github.com:zhaofengli/attic#attic-client' -- attic login --set-default ci "$ATTIC_SERVER" "$ATTIC_TOKEN"
nix run 'github.com:zhaofengli/attic#attic-client' -- attic use "$ATTIC_CACHE"
env:
ATTIC_SERVER: ${{ secrets.ATTIC_SERVER }}
ATTIC_CACHE: ${{ secrets.ATTIC_CACHE }}
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}

- name: Run flake checks
run: |
nix run 'github.com:zhaofengli/attic#attic-client' -- attic watch-store "ci:$ATTIC_CACHE" &
nix flake check
kill %1

0 comments on commit 65da72a

Please sign in to comment.