11name : Nixpkgs Bump PR
22
3- # Triggers on stable release publish. Opens PR against NixOS/nixpkgs
4- # bumping pkgs/by-name/ma/matcha/package.nix to the new version.
3+ # Manual dispatch only. r-ryantm bot handles automated bumps in nixpkgs.
4+ # This workflow exists for emergency / out-of-band bumps.
5+ # Uses whatever Go version is current on nixpkgs master.
56# Requires:
67# - Fork floatpane/nixpkgs to exist
7- # - NIXPKGS_BUMP_TOKEN secret: PAT with `repo` scope on floatpane/nixpkgs
8+ # - HOMEBREW_GITHUB_TOKEN secret: PAT with `repo` scope on floatpane/nixpkgs
89# and permission to open PRs against NixOS/nixpkgs
9- # - Initial matcha package already merged into nixpkgs (this workflow updates, not inits)
10+ # - Initial matcha package already merged into nixpkgs
1011
1112on :
12- release :
13- types : [published]
1413 workflow_dispatch :
1514 inputs :
1615 version :
@@ -24,33 +23,13 @@ jobs:
2423 bump :
2524 runs-on : ubuntu-latest
2625 steps :
27- - name : Determine version
28- id : ver
29- run : |
30- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
31- VERSION="${{ inputs.version }}"
32- else
33- TAG="${{ github.event.release.tag_name }}"
34- VERSION="${TAG#v}"
35- fi
36- # Skip nightly / preview tags
37- if [[ "$VERSION" == nightly* || "$VERSION" == preview* ]]; then
38- echo "Skipping non-stable release: $VERSION"
39- echo "skip=true" >> $GITHUB_OUTPUT
40- else
41- echo "skip=false" >> $GITHUB_OUTPUT
42- fi
43- echo "version=$VERSION" >> $GITHUB_OUTPUT
44-
4526 - name : Install Nix
46- if : steps.ver.outputs.skip != 'true'
4727 uses : cachix/install-nix-action@v31
4828 with :
4929 extra_nix_config : |
5030 experimental-features = nix-command flakes
5131
5232 - name : Checkout nixpkgs fork
53- if : steps.ver.outputs.skip != 'true'
5433 uses : actions/checkout@v6
5534 with :
5635 repository : floatpane/nixpkgs
@@ -59,123 +38,88 @@ jobs:
5938 fetch-depth : 0
6039
6140 - name : Sync fork with upstream master
62- if : steps.ver.outputs.skip != 'true'
6341 working-directory : nixpkgs
6442 run : |
6543 git config user.name "Floatpane Bot"
6644 git config user.email "us@floatpane.com"
6745 git remote add upstream https://github.com/NixOS/nixpkgs.git
68- git fetch upstream master staging
46+ git fetch upstream master
6947 git checkout master
7048 git reset --hard upstream/master
7149 git push origin master --force-with-lease
7250
7351 - name : Get current version (from master)
74- if : steps.ver.outputs.skip != 'true'
7552 id : current
7653 working-directory : nixpkgs
7754 run : |
7855 PKG=pkgs/by-name/ma/matcha/package.nix
7956 OLD=$(grep -E '^\s*version\s*=\s*"' "$PKG" | head -1 | sed -E 's/.*"([^"]+)".*/\1/')
8057 echo "old=$OLD" >> $GITHUB_OUTPUT
8158
82- - name : Write go overlay from staging
83- if : steps.ver.outputs.skip != 'true'
84- working-directory : nixpkgs
85- run : |
86- # master nixpkgs heavily cached. Staging has go_1_26 = 1.26.3.
87- # Overlay swaps only go_1_26 → minimal rebuild.
88- STAGING_REV=$(git rev-parse upstream/staging)
89- echo "STAGING_REV=$STAGING_REV" >> $GITHUB_ENV
90- cat > /tmp/go-overlay.nix <<EOF
91- let
92- staging = import (builtins.fetchTarball
93- "https://github.com/NixOS/nixpkgs/archive/$STAGING_REV.tar.gz") {};
94- in final: prev: {
95- go_1_26 = staging.go_1_26;
96- go = staging.go_1_26;
97- buildGoModule = prev.buildGoModule.override { go = staging.go_1_26; };
98- }
99- EOF
100- cat /tmp/go-overlay.nix
101-
10259 - name : Create bump branch
103- if : steps.ver.outputs.skip != 'true'
10460 working-directory : nixpkgs
10561 run : |
106- BRANCH="matcha-${{ steps.ver.outputs .version }}"
62+ BRANCH="matcha-${{ inputs .version }}"
10763 git checkout -b "$BRANCH"
10864 echo "BRANCH=$BRANCH" >> $GITHUB_ENV
10965
11066 - name : Bump version and reset hashes
111- if : steps.ver.outputs.skip != 'true'
11267 working-directory : nixpkgs
11368 run : |
11469 PKG=pkgs/by-name/ma/matcha/package.nix
115- NEW="${{ steps.ver.outputs.version }}"
116- # Replace version line
70+ NEW="${{ inputs.version }}"
11771 sed -i -E "s/(version\s*=\s*\")[^\"]+(\")/\1$NEW\2/" "$PKG"
118- # Reset src hash + vendorHash to fakeHash so nix build prints real ones
11972 sed -i -E 's|hash = "sha256-[A-Za-z0-9+/=]+"|hash = lib.fakeHash|' "$PKG"
12073 sed -i -E 's|vendorHash = "sha256-[A-Za-z0-9+/=]+"|vendorHash = lib.fakeHash|' "$PKG"
12174
12275 - name : Prefetch src hash (no build)
123- if : steps.ver.outputs.skip != 'true'
12476 id : src_hash
12577 working-directory : nixpkgs
12678 run : |
127- NEW="${{ steps.ver.outputs .version }}"
79+ NEW="${{ inputs .version }}"
12880 URL="https://github.com/floatpane/matcha/archive/refs/tags/v$NEW.tar.gz"
129- # --unpack matches fetchFromGitHub (NAR hash of unpacked tarball)
13081 BASE32=$(nix-prefetch-url --unpack "$URL")
13182 HASH=$(nix hash to-sri --type sha256 "$BASE32")
13283 echo "Resolved SRI hash: $HASH"
13384 echo "hash=$HASH" >> $GITHUB_OUTPUT
13485 sed -i -E "s|hash = lib.fakeHash|hash = \"$HASH\"|" pkgs/by-name/ma/matcha/package.nix
13586
13687 - name : Build to extract vendorHash
137- if : steps.ver.outputs.skip != 'true'
13888 working-directory : nixpkgs
13989 run : |
14090 set +e
141- nix-build ./. -A matcha --no-out-link \
142- --arg overlays "[ (import /tmp/go-overlay.nix) ]" \
143- 2>&1 | tee /tmp/build-vendor.log
91+ nix-build ./. -A matcha --no-out-link 2>&1 | tee /tmp/build-vendor.log
14492 HASH=$(grep -oE 'got:[[:space:]]+sha256-[A-Za-z0-9+/=]+' /tmp/build-vendor.log | head -1 | awk '{print $2}')
14593 if [ -z "$HASH" ]; then
14694 echo "Failed to extract vendorHash"; exit 1
14795 fi
14896 sed -i -E "s|vendorHash = lib.fakeHash|vendorHash = \"$HASH\"|" pkgs/by-name/ma/matcha/package.nix
14997
15098 - name : Final build (sanity check)
151- if : steps.ver.outputs.skip != 'true'
15299 working-directory : nixpkgs
153100 run : |
154- nix-build ./. -A matcha --no-out-link \
155- --arg overlays "[ (import /tmp/go-overlay.nix) ]"
101+ nix-build ./. -A matcha --no-out-link
156102
157103 - name : Commit and push
158- if : steps.ver.outputs.skip != 'true'
159104 working-directory : nixpkgs
160105 run : |
161106 git add pkgs/by-name/ma/matcha/package.nix
162- git commit -m "matcha: ${{ steps.current.outputs.old }} -> ${{ steps.ver.outputs .version }}"
107+ git commit -m "matcha: ${{ steps.current.outputs.old }} -> ${{ inputs .version }}"
163108 git push -u origin "$BRANCH" --force-with-lease
164109
165110 - name : Open PR against NixOS/nixpkgs
166- if : steps.ver.outputs.skip != 'true'
167111 env :
168112 GH_TOKEN : ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
169113 working-directory : nixpkgs
170114 run : |
171115 BODY=$(cat <<EOF
172116 ## Description
173117
174- Automated version bump for \`matcha\` email client.
118+ Manual version bump for \`matcha\` email client.
175119
176120 - Old: ${{ steps.current.outputs.old }}
177- - New: ${{ steps.ver.outputs .version }}
178- - Upstream release: https://github.com/floatpane/matcha/releases/tag/v${{ steps.ver.outputs .version }}
121+ - New: ${{ inputs .version }}
122+ - Upstream release: https://github.com/floatpane/matcha/releases/tag/v${{ inputs .version }}
179123
180124 ## Things done
181125
@@ -190,5 +134,5 @@ jobs:
190134 --repo NixOS/nixpkgs \
191135 --base master \
192136 --head "floatpane:$BRANCH" \
193- --title "matcha: ${{ steps.current.outputs.old }} -> ${{ steps.ver.outputs .version }}" \
137+ --title "matcha: ${{ steps.current.outputs.old }} -> ${{ inputs .version }}" \
194138 --body "$BODY"
0 commit comments