-
Notifications
You must be signed in to change notification settings - Fork 73
101 lines (90 loc) · 3.85 KB
/
Copy pathdependencies.yml
File metadata and controls
101 lines (90 loc) · 3.85 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Dependencies
on:
schedule:
- cron: "0 5 * * *"
# All PR event types are listed so GitHub delivers the event payload (which includes label info).
# The job-level `if` then gates execution on the `run-bump-ci` label — GitHub's `on:` syntax
# has no native label filter, so this two-part pattern is the standard workaround.
pull_request:
types: [labeled, synchronize, opened, reopened]
workflow_dispatch:
inputs:
libp2p_ref:
description: "nim-libp2p branch, tag, or SHA to test"
required: false
default: ""
jobs:
bumper:
# Pushes new refs to interested external repositories, so they can do early testing against libp2p's newer versions
# Scheduled runs proceed when DEPENDENCIES_AUTOBUMP_ENABLED is unset or true; set it to false to disable.
if: >
(github.event_name != 'schedule' ||
vars.DEPENDENCIES_AUTOBUMP_ENABLED == '' ||
vars.DEPENDENCIES_AUTOBUMP_ENABLED == 'true') &&
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-bump-ci'))
runs-on: ubuntu-latest
name: Bump libp2p's version for ${{ matrix.target.repository }}:${{ matrix.target.ref }}
strategy:
fail-fast: false
matrix:
target:
- repository: status-im/nimbus-eth2
ref: unstable
secret: ACTIONS_GITHUB_TOKEN_NIMBUS_ETH2
- repository: status-im/nimbus-eth2
ref: stable
secret: ACTIONS_GITHUB_TOKEN_NIMBUS_ETH2
- repository: logos-messaging/logos-delivery
ref: master
secret: ACTIONS_GITHUB_TOKEN_NWAKU
nimble: true
- repository: codex-storage/nim-codex
ref: master
secret: ACTIONS_GITHUB_TOKEN_NIM_CODEX
steps:
- name: Clone target repository
uses: actions/checkout@v6
with:
repository: ${{ matrix.target.repository }}
ref: ${{ matrix.target.ref}}
path: nbc
fetch-depth: 0
token: ${{ secrets[matrix.target.secret] }}
- name: Setup Nim (only for nimble targets)
if: matrix.target.nimble == true
uses: jiro4989/setup-nim-action@v2
with:
nim-version: '2.2.4' # should be the same as the one in logos-delivery/nimbus/codex
- name: Checkout this ref in target repository
env:
LIBP2P_REF: ${{ inputs.libp2p_ref || github.event.pull_request.head.sha || github.sha }}
run: |
cd nbc
if [ "${{ matrix.target.nimble }}" = "true" ]; then
# Update waku.nimble: replace ref after 'nim-libp2p.git#' with selected ref
perl -0pi -e 's|(https://github[.]com/vacp2p/nim-libp2p[.]git#)[^"[:space:]]+|$1$ENV{LIBP2P_REF}|' waku.nimble
# Clean previous state
rm -rf nimble.lock nimbledeps nimble.paths
# Ensure nimble is up-to-date
nimble install nimble -y
# Regenerate lock file
nimble setup --localdeps -y
else
git submodule update --init vendor/nim-libp2p
cd vendor/nim-libp2p
git fetch https://github.com/vacp2p/nim-libp2p.git "$LIBP2P_REF"
git checkout FETCH_HEAD
fi
- name: Push this ref to target repository
run: |
cd nbc
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
if [ -z "$(git status --porcelain)" ]; then
echo "No dependency changes detected; skipping push."
exit 0
fi
git commit -a -m "auto-bump nim-libp2p"
git branch -D nim-libp2p-auto-bump-${{ matrix.target.ref }} || true
git switch -c nim-libp2p-auto-bump-${{ matrix.target.ref }}
git push -f origin nim-libp2p-auto-bump-${{ matrix.target.ref }}