Skip to content

Commit b8fd280

Browse files
authored
chore: added workflow to release contracts (#948)
* chore: added workflow to release contracts * chore: added `wasm32-unknown-unknown` target * chore: build only `eth2-client` * chore: renamed tag name * chore: removed lfs
1 parent feb7171 commit b8fd280

File tree

10 files changed

+65
-111
lines changed

10 files changed

+65
-111
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
on:
2+
push:
3+
tags:
4+
- 'eth2-client-v[0-9]+.[0-9]+.[0-9]+*'
5+
6+
workflow_dispatch:
7+
8+
name: Update Contracts
9+
jobs:
10+
update-contracts:
11+
runs-on: ubuntu-latest
12+
name: Update Contracts
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Clone the repository
17+
uses: actions/checkout@v3
18+
19+
- name: Install cargo-near
20+
run: |
21+
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh
22+
23+
- name: Build NEAR contracts
24+
run: |
25+
cd contracts/near
26+
make build-eth2-client
27+
timeout-minutes: 60
28+
29+
- name: Archive built WASM files
30+
env:
31+
RAW_TAG: ${{ github.ref_name }}
32+
run: |
33+
SAFE_TAG="${RAW_TAG//./-}"
34+
ZIP_NAME="${SAFE_TAG}.zip"
35+
mkdir -p artifacts
36+
find ./contracts/near/target/near -name "*.wasm" -exec cp {} artifacts/ \;
37+
zip -j "$ZIP_NAME" artifacts/*
38+
shell: bash
39+
40+
- name: Create Release
41+
uses: softprops/action-gh-release@v2
42+
with:
43+
tag_name: ${{ github.ref_name }}
44+
files: "*.zip"

β€Žcontracts/near/Makefileβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ MAKEFILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
33
MANIFEST := $(MAKEFILE_DIR)/Cargo.toml
44

55
build-eth2-client:
6-
cargo near build reproducible-wasm --manifest-path $(MAKEFILE_DIR)/eth2-client/Cargo.toml --out-dir $(MAKEFILE_DIR)/res
6+
cargo near build reproducible-wasm --manifest-path $(MAKEFILE_DIR)/eth2-client/Cargo.toml
77

88
build-prover:
9-
cargo near build non-reproducible-wasm --manifest-path $(MAKEFILE_DIR)/eth-prover/Cargo.toml --out-dir $(MAKEFILE_DIR)/res --no-abi
9+
cargo near build reproducible-wasm --manifest-path $(MAKEFILE_DIR)/eth-prover/Cargo.toml
1010

1111
build: build-eth2-client build-prover
1212

β€Žcontracts/near/build_all.shβ€Ž

Lines changed: 0 additions & 13 deletions
This file was deleted.

β€Žcontracts/near/eth-client/Cargo.tomlβ€Ž

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@ name = "eth-client"
33
version = "0.1.0"
44
authors = ["Near Inc <hello@nearprotocol.com>"]
55
edition = "2021"
6+
repository.workspace = true
7+
8+
# fields to configure build with WASM reproducibility, according to specs
9+
# in https://github.com/near/NEPs/blob/master/neps/nep-0330.md
10+
[package.metadata.near.reproducible_build]
11+
# docker image, descriptor of build environment
12+
image = "sourcescan/cargo-near:0.13.2-rust-1.84.0"
13+
# tag after colon above serves only descriptive purpose; image is identified by digest
14+
image_digest = "sha256:b41cb89907f92b114da9e2be4e109bff30ab792c22ddcbd2a4cff8e340cb9acb"
15+
# list of environment variables names, whose values, if set, will be used as external build parameters
16+
# in a reproducible manner
17+
# supported by `sourcescan/cargo-near:0.10.1-rust-1.82.0` image or later images
18+
passed_env = []
19+
# build command inside of docker container
20+
# if docker image from default gallery is used https://hub.docker.com/r/sourcescan/cargo-near/tags,
21+
# the command may be any combination of flags of `cargo-near`,
22+
# supported by respective version of binary inside the container besides `--no-locked` flag
23+
container_build_command = ["cargo", "near", "build", "non-reproducible-wasm", "--locked"]
624

725
[lib]
826
crate-type = ["cdylib", "rlib"]

β€Žcontracts/near/eth-client/build.shβ€Ž

Lines changed: 0 additions & 32 deletions
This file was deleted.

β€Žcontracts/near/eth-prover/build.shβ€Ž

Lines changed: 0 additions & 32 deletions
This file was deleted.

β€Žcontracts/near/eth2-client/build.shβ€Ž

Lines changed: 0 additions & 32 deletions
This file was deleted.
-382 KB
Binary file not shown.
-285 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[toolchain]
22
channel = "1.84.0"
3+
targets = ["wasm32-unknown-unknown"]

0 commit comments

Comments
Β (0)