fix: cachix action config

This commit is contained in:
Adriano Caloiaro 2025-04-08 15:49:53 -06:00
parent 0c8b4ec1d1
commit d128437bb9
No known key found for this signature in database
GPG key ID: C2BC56DE73CE3F75
2 changed files with 25 additions and 20 deletions

View file

@ -23,12 +23,10 @@ jobs:
- name: install nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v14
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v16
with:
name: devenv
env:
USER: root
- name: Install devenv.sh
run: nix profile install nixpkgs#devenv
- name: Setup go
@ -38,23 +36,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
- name: Bump version and push tag
shell: bash -c 'nix develop --no-pure-eval -c {0}'
run: |
git config --global user.email "actions@github.com"
git config --global user.name "Github Actions"
go install github.com/caarlos0/svu@latest
OLD_TAG=$(svu current)
NEW_TAG=$(svu next)
[ "$OLD_TAG" == "$NEW_TAG" ] && echo "no version bump" && exit 0
echo default.nix README.md | xargs sed -i "s/$(svu current)/$(svu next)/g"
go mod vendor
sed -i "s|vendorHash = \".*\"|vendorHash = \"$(nix hash path ./vendor | tr --delete '\n')\"|g" default.nix
git add default.nix main.go README.md
git commit -m "bump release version" --allow-empty
git tag v$NEW_TAG
git tag $NEW_TAG
git push
git push --tags
nix develop --no-pure-eval --accept-flake-config --command bash -c 'prepare-release'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:

View file

@ -42,6 +42,28 @@
gopls
svu
];
scripts = with pkgs; {
prepare-release = {
description = "prepare a release";
exec = ''
git config --global user.email 'actions@github.com'
git config --global user.name 'Github Actions'
OLD_TAG=$(svu current)
NEW_TAG=$(svu next)
[ "$OLD_TAG" == "$NEW_TAG" ] && echo "no version bump" && exit 0
echo default.nix README.md | xargs sed -i "s/$(svu current)/$(svu next)/g"
go mod vendor
sed -i "s|vendorHash = \".*\"|vendorHash = \"$(nix hash path ./vendor)\"|g" default.nix
git add default.nix main.go README.md
git commit -m "bump release version" --allow-empty
git tag v$NEW_TAG
git tag $NEW_TAG
git push
git push --tags
'';
};
};
}
];
};