Skip to content

Commit d128437

Browse files
committed
fix: cachix action config
1 parent 0c8b4ec commit d128437

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

.github/workflows/goreleaser.yml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ jobs:
2323
- name: install nix
2424
uses: cachix/install-nix-action@v31
2525
with:
26-
nix_path: nixpkgs=channel:nixos-unstable
27-
- uses: cachix/cachix-action@v14
26+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
27+
- uses: cachix/cachix-action@v16
2828
with:
2929
name: devenv
30-
env:
31-
USER: root
3230
- name: Install devenv.sh
3331
run: nix profile install nixpkgs#devenv
3432
- name: Setup go
@@ -38,23 +36,8 @@ jobs:
3836
env:
3937
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
4038
- name: Bump version and push tag
41-
shell: bash -c 'nix develop --no-pure-eval -c {0}'
4239
run: |
43-
git config --global user.email "actions@github.com"
44-
git config --global user.name "Github Actions"
45-
go install github.com/caarlos0/svu@latest
46-
OLD_TAG=$(svu current)
47-
NEW_TAG=$(svu next)
48-
[ "$OLD_TAG" == "$NEW_TAG" ] && echo "no version bump" && exit 0
49-
echo default.nix README.md | xargs sed -i "s/$(svu current)/$(svu next)/g"
50-
go mod vendor
51-
sed -i "s|vendorHash = \".*\"|vendorHash = \"$(nix hash path ./vendor | tr --delete '\n')\"|g" default.nix
52-
git add default.nix main.go README.md
53-
git commit -m "bump release version" --allow-empty
54-
git tag v$NEW_TAG
55-
git tag $NEW_TAG
56-
git push
57-
git push --tags
40+
nix develop --no-pure-eval --accept-flake-config --command bash -c 'prepare-release'
5841
- name: Run GoReleaser
5942
uses: goreleaser/goreleaser-action@v4
6043
with:

flake.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@
4242
gopls
4343
svu
4444
];
45+
46+
scripts = with pkgs; {
47+
prepare-release = {
48+
description = "prepare a release";
49+
exec = ''
50+
git config --global user.email 'actions@github.com'
51+
git config --global user.name 'Github Actions'
52+
OLD_TAG=$(svu current)
53+
NEW_TAG=$(svu next)
54+
[ "$OLD_TAG" == "$NEW_TAG" ] && echo "no version bump" && exit 0
55+
echo default.nix README.md | xargs sed -i "s/$(svu current)/$(svu next)/g"
56+
go mod vendor
57+
sed -i "s|vendorHash = \".*\"|vendorHash = \"$(nix hash path ./vendor)\"|g" default.nix
58+
git add default.nix main.go README.md
59+
git commit -m "bump release version" --allow-empty
60+
git tag v$NEW_TAG
61+
git tag $NEW_TAG
62+
git push
63+
git push --tags
64+
'';
65+
};
66+
};
4567
}
4668
];
4769
};

0 commit comments

Comments
 (0)