Commit 826b6bf 1 parent cc25771 commit 826b6bf Copy full SHA for 826b6bf
File tree 5 files changed +118
-5
lines changed
5 files changed +118
-5
lines changed Original file line number Diff line number Diff line change
1
+ name : Prepare Release
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' *'
7
+
8
+ env :
9
+ FOUNDRY_PROFILE : ci
10
+
11
+ permissions :
12
+ contents : write
13
+
14
+ jobs :
15
+ check :
16
+ strategy :
17
+ fail-fast : true
18
+
19
+ name : Foundry project
20
+ runs-on : ubuntu-latest
21
+ steps :
22
+ - uses : actions/checkout@v3
23
+ with :
24
+ submodules : recursive
25
+
26
+ - name : Install Foundry
27
+ uses : foundry-rs/foundry-toolchain@v1
28
+ with :
29
+ version : nightly
30
+
31
+ - name : Run Forge build
32
+ run : |
33
+ forge build
34
+
35
+ - name : Prepare Release
36
+ run : |
37
+ script/prepare-release.sh
38
+ env :
39
+ CODE_JAR : ${{ vars.CODE_JAR }}
40
+ RPC_URL : ${{ vars.SEPOLIA_RPC_URL }}
41
+
42
+ - uses : ncipollo/release-action@v1
43
+ with :
44
+ ref : " ${{ github.sha }}"
45
+ artifacts : " release/Sleuth.json,release/Sleuth.sol,release/sleuth@*"
46
+ bodyFile : " release/RELEASE.md"
Original file line number Diff line number Diff line change 1
1
name : test
2
2
3
- on : workflow_dispatch
3
+ on :
4
+ push :
4
5
5
6
env :
6
7
FOUNDRY_PROFILE : ci
Original file line number Diff line number Diff line change 1
1
# Compiler files
2
2
cache /
3
3
out /
4
+ release /
4
5
5
6
# Ignores development broadcast logs
6
7
! /broadcast
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: UNLICENSED
2
- pragma solidity ^ 0.8.13 ;
2
+ pragma solidity ^ 0.8.23 ;
3
3
4
4
import "forge-std/Script.sol " ;
5
+ import "../src/Sleuth.sol " ;
5
6
6
- contract SleuthScript is Script {
7
+ interface CodeJar {
8
+ function saveCode (bytes memory code ) external returns (address );
9
+ }
10
+
11
+ contract Prepare is Script {
7
12
function setUp () public {}
8
13
9
- function run () public {
10
- vm.broadcast ();
14
+ function run () public returns (address ) {
15
+ CodeJar codeJar = CodeJar (vm.envAddress ("CODE_JAR " ));
16
+ console.log ("Code Jar Address: " , address (codeJar));
17
+ console.log ("Chain ID: " , block .chainid );
18
+ console.logBytes (address (codeJar).code);
19
+
20
+ address sleuthAddress = codeJar.saveCode (type (Sleuth).creationCode);
21
+
22
+ console.log ("Sleuth Address: " , sleuthAddress);
23
+
24
+ return sleuthAddress;
11
25
}
12
26
}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -eo pipefail
4
+
5
+ if [ -z " $CODE_JAR " ]; then
6
+ echo " Missing CODE_JAR env var"
7
+ exit 1
8
+ fi
9
+
10
+ if [ -z " $RPC_URL " ]; then
11
+ echo " Missing RPC_URL env var"
12
+ exit 1
13
+ fi
14
+
15
+ if ! command -v jq & > /dev/null; then
16
+ echo " jq could not be found"
17
+ exit 1
18
+ fi
19
+
20
+ forge build
21
+ mkdir -p release/
22
+ cp out/Sleuth.sol/Sleuth.json release/
23
+ cp src/Sleuth.sol release/
24
+ title=" $( git log -1 --pretty=" %s" ) "
25
+ body=" $( git log -1 --pretty=" %b" ) "
26
+
27
+ if [ -z " $title " ]; then
28
+ echo " must include git commit title"
29
+ exit 1
30
+ fi
31
+
32
+ if [ -z " $body " ]; then
33
+ echo " must include git commit body"
34
+ exit 1
35
+ fi
36
+
37
+ sleuth_address=" $( forge script --rpc-url=" $RPC_URL " --json --silent script/Sleuth.s.sol:Prepare | tee | jq -r ' .returns."0".value' ) "
38
+
39
+ echo " title=$title "
40
+ echo " body=$body "
41
+ echo " sleuth_address=$sleuth_address "
42
+
43
+ echo " $sleuth_address " > " release/sleuth@$sleuth_address "
44
+
45
+ cat > release/RELEASE.md << EOF
46
+ ## $title
47
+
48
+ Sleuth Address: $sleuth_address
49
+
50
+ $body
51
+ EOF
You can’t perform that action at this time.
0 commit comments