Dependencies Bump #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dependencies Bump | |
on: | |
schedule: | |
# Run this job everyday at 5:30 AM UTC+8 | |
- cron: '30 21 * * *' | |
workflow_dispatch: | |
jobs: | |
bump-deps: | |
name: "Bump Chisel and CIRCT" | |
if: ${{ !cancelled() }} | |
runs-on: [self-hosted, linux, nixos] | |
permissions: | |
contents: write | |
defaults: | |
run: | |
working-directory: ./templates/chisel | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: master | |
- name: Bump nixpkgs | |
run: | | |
nix flake update | |
- name: Bump Chisel | |
run: | | |
cd nix/pkgs/dependencies | |
nix run '.#nvfetcher' -- -f '^chisel$' | |
- name: Bump all mill deps | |
run: | | |
oldHash=$(nix derivation show .#gcd.gcd-compiled.millDeps | jq -r 'to_entries[0].value.env.outputHash') | |
nix build '.#gcd.gcd-compiled.millDeps' --rebuild > milldeps-log.txt 2>&1 || true | |
newHash=$(cat milldeps-log.txt \ | |
| grep -P '^\s+got:\s+sha256-.*$' \ | |
| cut -d':' -f2 \ | |
| xargs) | |
if [ -z "$newHash" ] || [ "$newHash" = "$oldHash" ]; then | |
echo "Original build logs for debug: " | |
cat milldeps-log.txt | |
echo "Hash unchanged, exit" | |
exit 0 | |
fi | |
echo "Updating hash $oldHash to $newHash" | |
sed -i "s|$oldHash|$newHash|" nix/gcd/gcd.nix | |
- name: Commit changes | |
env: | |
GH_TOKEN: ${{ secrets.CI_BUMP_TOKEN }} | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
currentDate=$(date +%F) | |
branch="dependencies-bumping-$currentDate" | |
git checkout -b "$branch" | |
git add 'nix/pkgs/dependencies' | |
git add 'nix/gcd/gcd.nix' | |
git add 'flake.lock' | |
if ! git diff --quiet --cached --exit-code; then | |
updatedFiles=$(git diff --cached --name-only) | |
echo "File changed" | |
git commit -m "[deps] Bump dependencies" | |
git push origin "$branch" --force-with-lease | |
nix run '.#gh' -- \ | |
pr create --title "Bump dependencies" --body "Updated: $updatedFiles" | |
fi |