@@ -10,22 +10,44 @@ jobs:
10
10
runs-on : ubuntu-latest
11
11
steps :
12
12
- uses : actions/checkout@v3
13
+
13
14
- uses : cachix/install-nix-action@v15
14
15
with :
15
16
nix_path : nixpkgs=channel:nixos-unstable
16
17
extra_nix_config : |
17
18
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
18
19
substituters = https://cache.iog.io https://cache.zw3rk.com https://cache.nixos.org/
20
+
19
21
- name : " Update hackage.nix and stackage.nix"
20
22
run : |
21
23
export CABAL_DIR=$HOME/.cabal
22
24
nix run github:input-output-hk/haskell.nix#cabal -- v2-update
23
25
nix run github:input-output-hk/haskell.nix#hackage-to-nix -- . $CABAL_DIR/packages/hackage.haskell.org/01-index.tar
24
26
nix run github:input-output-hk/haskell.nix#haskell-nix.update-index-state-hashes > index-state-hashes.nix
25
- - name : Commit and push changes
27
+
28
+ - name : " Commit and push changes to main branch"
26
29
run : |
27
30
git config --local user.email "[email protected] "
28
31
git config --local user.name "IOHK"
29
32
git add .
30
- git commit -m "Automatic Update"
33
+ git commit -m "Automatic Update" || echo "No changes to commit"
31
34
git push
35
+
36
+ - name : " Update index-state-only branch"
37
+ run : |
38
+ if git show-ref --verify --quiet refs/heads/index-state-only; then
39
+ git checkout index-state-only
40
+ git merge main --no-edit
41
+ else
42
+ git checkout -b index-state-only
43
+ fi
44
+
45
+ # Remove the 'hackage' directory so that only index-state-hashes.nix remains.
46
+ rm -rf hackage
47
+
48
+ # Stage deletions and any other changes, and commit if there are differences.
49
+ git add -A
50
+ git diff --cached --quiet || git commit -m "Update index-state-only branch"
51
+
52
+ # Push the branch normally (no force push).
53
+ git push origin index-state-only
0 commit comments