-
-
Notifications
You must be signed in to change notification settings - Fork 40
feat: auto update nix repository #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
68e88f7
0c38c17
53375bc
abcb12a
23aa100
bc67569
2dcbfc5
b289506
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/usr/bin/env bash | ||
| # edit version in package.nix | ||
| sed -i "s/version = \".*\"/version = \"$VERSION\"/" package.nix | ||
|
|
||
| #x86 linux | ||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.linux-x86_64.tar.xz" | ||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||
| SANITIZE_HASH=$(sed -e 's/[&\\/]/\\&/g; s/$/\\/' -e '$s/\\$//' <<<"$NEW_HASH") | ||
| sed -zi "s/sha256 = \".*\"/sha256 = \"${SANITIZE_HASH}\"/1m" package.nix | ||
|
|
||
| #aarch64 linux | ||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.linux-aarch64.tar.xz" | ||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||
| SANITIZE_HASH=$(sed -e 's/[&\\/]/\\&/g; s/$/\\/' -e '$s/\\$//' <<<"$NEW_HASH") | ||
| sed -zi "s/sha256 = \".*\"/sha256 = \"${SANITIZE_HASH}\"/2m" package.nix | ||
|
|
||
| #x86 macos | ||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.macos-x86_64.dmg" | ||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||
| SANITIZE_HASH=$(sed -e 's/[&\\/]/\\&/g; s/$/\\/' -e '$s/\\$//' <<<"$NEW_HASH") | ||
| sed -zi "s/sha256 = \".*\"/sha256 = \"${SANITIZE_HASH}\"/3m" package.nix | ||
|
|
||
| #aarch64 macos | ||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.macos-aarch64.dmg" | ||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||
| SANITIZE_HASH=$(sed -e 's/[&\\/]/\\&/g; s/$/\\/' -e '$s/\\$//' <<<"$NEW_HASH") | ||
| sed -zi "s/sha256 = \".*\"/sha256 = \"${SANITIZE_HASH}\"/4m" package.nix | ||
|
|
||
| if [ -z "$GITHUB_OUTPUT" ]; then | ||
| echo $(cat package.nix) >>$GITHUB_OUTPUT | ||
| else | ||
| cat package.nix | ||
| fi |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,3 +26,60 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||
| git checkout -b docs-production origin/docs-production | ||||||||||||||||||||||||||||||||||||||||||||||
| git reset --hard origin/main | ||||||||||||||||||||||||||||||||||||||||||||||
| git push --force-with-lease | ||||||||||||||||||||||||||||||||||||||||||||||
| update-nix: | ||||||||||||||||||||||||||||||||||||||||||||||
| name: Update glide nix flake | ||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||
| - name: install nix | ||||||||||||||||||||||||||||||||||||||||||||||
| uses: DeterminateSystems/determinate-nix-action@1d699fc25db3f9e079cd2f168ca007a4183389be # or v3.15.1 to pin to a release | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: clone glide.nix repo | ||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | ||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||
| token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||
| persist-credentials: true | ||||||||||||||||||||||||||||||||||||||||||||||
| repository : "glide-browser/glide.nix" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: update hashes | ||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||
| VERSION: inputs.tag_name || ${{ github.event.release.tag_name }} | ||||||||||||||||||||||||||||||||||||||||||||||
|
nixith marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GITHUB_TOKEN isn't set in the secrets for this repo, I think this should work
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||
| git switch -c "update-$VERSION" | ||||||||||||||||||||||||||||||||||||||||||||||
| .github/scripts/update_nix.sh | ||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually just realised this won't work because you're only checking out the glide.nix repo. either the script could live in glide.nix or you'd have to checkout the glide repo and glide.nix to different directories
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we actually need any data from the glide repo? It could always live in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think it'd make sense for the script to live in glide.nix at a minimum. I'm not aware of a nice builtin way to do cross-repo webhooks without having to host a server in the middle. So the options in my mind are:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looking into this I think the best bet we have is moving forward with option 2 (simplified my work a lot, I can use the actions you mentioned) and using the github cli to do |
||||||||||||||||||||||||||||||||||||||||||||||
| # edit version in package.nix | ||||||||||||||||||||||||||||||||||||||||||||||
| sed -i 's/version = ".*"/version = "$VERSION"/' package.nix | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| #x86 linux | ||||||||||||||||||||||||||||||||||||||||||||||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.linux-x86_64.tar.xz" | ||||||||||||||||||||||||||||||||||||||||||||||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||||||||||||||||||||||||||||||||||||||||||||||
| sed -zi 's/sha256 = ".*"/sha256 = "$NEW_HASH"/1m' package.nix | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| #aarch64 linux | ||||||||||||||||||||||||||||||||||||||||||||||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.linux-aarch64.tar.xz" | ||||||||||||||||||||||||||||||||||||||||||||||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||||||||||||||||||||||||||||||||||||||||||||||
| sed -zi 's/sha256 = ".*"/sha256 = "$NEW_HASH"/2m' package.nix | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| #x86 macos | ||||||||||||||||||||||||||||||||||||||||||||||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.macos-x86_64.dmg" | ||||||||||||||||||||||||||||||||||||||||||||||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||||||||||||||||||||||||||||||||||||||||||||||
| sed -zi 's/sha256 = ".*"/sha256 = "$NEW_HASH"/3m' package.nix | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| #aarch64 macos | ||||||||||||||||||||||||||||||||||||||||||||||
| RELEASE_LINK="https://github.com/glide-browser/glide/releases/download/$VERSION/glide.macos-aarch64.dmg" | ||||||||||||||||||||||||||||||||||||||||||||||
| NEW_HASH=$(nix hash to-sri --type sha256 $(nix-prefetch-url "$RELEASE_LINK")) | ||||||||||||||||||||||||||||||||||||||||||||||
| sed -zi 's/sha256 = ".*"/sha256 = "$NEW_HASH"/4m' package.nix | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+73
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should all be in the script now?
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # modification done | ||||||||||||||||||||||||||||||||||||||||||||||
| git add package.nix | ||||||||||||||||||||||||||||||||||||||||||||||
| git commit -m "update: v$VERSION" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # make pull request | ||||||||||||||||||||||||||||||||||||||||||||||
| gh -R "glide-browser/glide.nix" pr create --title "update to version $VERSION" --body "" --head "$update-$VERSION" | ||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this won't push the branch for you because you're passing
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # auto-merge | ||||||||||||||||||||||||||||||||||||||||||||||
| gh -R "glide-browser/glide.nix" pr merge "update-$VERSION" --auto --rebase | ||||||||||||||||||||||||||||||||||||||||||||||
| #TODO: check if this works | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.