Skip to content

Commit 15dfe4d

Browse files
committed
Add index-state-only branch update code
1 parent 08261aa commit 15dfe4d

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

Diff for: .github/workflows/update.yml

+24-2
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,44 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v3
13+
1314
- uses: cachix/install-nix-action@v15
1415
with:
1516
nix_path: nixpkgs=channel:nixos-unstable
1617
extra_nix_config: |
1718
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=
1819
substituters = https://cache.iog.io https://cache.zw3rk.com https://cache.nixos.org/
20+
1921
- name: "Update hackage.nix and stackage.nix"
2022
run: |
2123
export CABAL_DIR=$HOME/.cabal
2224
nix run github:input-output-hk/haskell.nix#cabal -- v2-update
2325
nix run github:input-output-hk/haskell.nix#hackage-to-nix -- . $CABAL_DIR/packages/hackage.haskell.org/01-index.tar
2426
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"
2629
run: |
2730
git config --local user.email "[email protected]"
2831
git config --local user.name "IOHK"
2932
git add .
30-
git commit -m "Automatic Update"
33+
git commit -m "Automatic Update" || echo "No changes to commit"
3134
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

Comments
 (0)