-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (64 loc) · 2.21 KB
/
daily-bump.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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