Commit 13c23df 1 parent 9ffc7e4 commit 13c23df Copy full SHA for 13c23df
File tree 2 files changed +17
-28
lines changed
2 files changed +17
-28
lines changed Original file line number Diff line number Diff line change 51
51
steps :
52
52
- uses : actions/checkout@v4
53
53
- uses : fregante/setup-git-user@v2.0.1
54
- - name : Push contracts to dedicated branches
54
+ - name : Push contracts to forge branch
55
55
run : scripts/publish-for-forge.sh
Original file line number Diff line number Diff line change 3
3
set -eu
4
4
5
5
clean () {
6
- pkg=" $1 "
7
6
# TODO: use regex instead
8
- find . -maxdepth 2 \
7
+ find . -maxdepth 1 \
9
8
! -path . \
10
9
! -path ./.git \
11
10
! -path " ./.git/*" \
12
- ! -path ./.gitignore \
13
11
! -path ./packages \
14
12
! -path ./LICENSE \
15
- ! -path " ./packages/$pkg " \
16
13
-exec rm -rf {} +
17
14
}
18
15
19
- maybe_publish_forge_pkg () {
20
- pkg=" $1 "
21
- version=$( jq -r ' .version' " packages/$pkg /package.json" )
22
- latest_commit_msg=$( git log -1 --pretty=%B)
23
-
24
- git checkout -b " $pkg "
25
- # return early if latest already published
26
- [ " $latest_commit_msg " = " $version " ] && return
27
- git pull --rebase origin " $pkg " 2> /dev/null || true
28
- clean " $pkg "
29
- mkdir " $pkg "
30
- mv " packages/$pkg " /src " $pkg "
31
- mv " packages/$pkg " /README.md " $pkg "
32
- mv LICENSE " $pkg "
33
- rm -fr " packages"
34
- git add " $pkg "
35
- git commit -am " $version "
36
- git push origin " $pkg "
37
- git checkout origin/" $GITHUB_HEAD_REF "
38
- }
39
-
40
16
main () {
41
- git fetch origin " $GITHUB_HEAD_REF "
17
+ git fetch origin main
18
+ latest_main_commit_msg=$( git log origin/main -1 --pretty=%B)
19
+
20
+ git checkout -b forge
21
+ clean
22
+
42
23
# http://mywiki.wooledge.org/BashFAQ/001
43
24
# https://github.com/koalaman/shellcheck/wiki/SC2012
44
25
find packages -maxdepth 1 -mindepth 1 -printf ' %P\n' | while read -r pkg; do
45
- maybe_publish_forge_pkg " $pkg "
26
+ mkdir " $pkg "
27
+ mv " packages/$pkg /src" " $pkg "
28
+ mv " packages/$pkg /README.md" " $pkg "
29
+ git add " $pkg "
46
30
done
31
+
32
+ rm -fr " packages"
33
+
34
+ git commit -am " $latest_main_commit_msg "
35
+ git push origin forge
47
36
}
48
37
49
38
main
You can’t perform that action at this time.
0 commit comments