Skip to content

v2.5.3

v2.5.3 #2

name: Update flake hashes
on:
workflow_dispatch:
inputs:
version:
description: "Release version. Defaults to Cargo.toml workspace version."
required: false
release:
types:
- published
permissions:
contents: write
pull-requests: write
jobs:
update-flake-hashes:
runs-on: ubuntu-latest
steps:
- name: Checkout GlobalProtect-openconnect
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Update flake hashes
env:
RELEASE_VERSION: ${{ github.event.release.tag_name || inputs.version }}
run: |
if [[ -n "$RELEASE_VERSION" ]]; then
scripts/update-flake-hashes.sh "$RELEASE_VERSION"
else
scripts/update-flake-hashes.sh
fi
- name: Open pull request
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ github.event.release.tag_name || inputs.version }}
run: |
if git diff --quiet -- flake.nix; then
echo "flake.nix hashes are already up to date"
exit 0
fi
version="${RELEASE_VERSION:-$(grep '^version' Cargo.toml | head -1 | sed 's/version *= *"\(.*\)"/\1/')}"
version="${version#v}"
branch="chore/update-flake-hashes-v${version}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -c "$branch"
git add flake.nix
git commit -m "chore: update flake hashes for v${version}"
git push --force-with-lease origin "$branch"
if gh pr view "$branch" --json number > /tmp/flake-pr.json 2> /dev/null; then
pr_number="$(jq -r '.number' /tmp/flake-pr.json)"
gh pr edit "$pr_number" \
--title "chore: update flake hashes for v${version}" \
--body "Updates the Nix flake fetchzip hashes for v${version} release assets."
else
gh pr create \
--title "chore: update flake hashes for v${version}" \
--body "Updates the Nix flake fetchzip hashes for v${version} release assets." \
--base main \
--head "$branch"
fi