Skip to content

Commit

Permalink
feat: fix release workflow auto deployment logic
Browse files Browse the repository at this point in the history
  • Loading branch information
h5law committed Jun 28, 2024
1 parent 941fe41 commit a4481d6
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 359 deletions.
46 changes: 36 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
tags:
- "v*.*.*"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
artifacts:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -35,7 +39,7 @@ jobs:
cp -r out/Moon.sol/Moon.json artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: compiled-contracts
path: artifacts
Expand All @@ -44,12 +48,17 @@ jobs:
runs-on: ubuntu-latest
needs: artifacts
environment: release
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: "recursive"

- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: compiled-contracts
path: ./artifacts
Expand All @@ -69,6 +78,12 @@ jobs:
needs: release
environment: release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: "recursive"

- name: Get Latest Version
id: version
uses: pozetroninc/github-action-get-latest-release@master
Expand All @@ -80,20 +95,31 @@ jobs:
with:
go-version: "1.21.3"

- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install ABIGen
run: |
go install github.com/ethereum/go-ethereum/cmd/abigen@v1.13.5
- uses: actions/setup-node@v4
with:
node-version: "22.3.0"
registry-url: "https://registry.npmjs.org"

- name: Install Bun
uses: oven-sh/setup-bun@v1

# Ensure /v2 is updated as the major version changes
- name: Update Go Registry
run: |
GOPROXY=proxy.golang.org go list \
-m github.com/open-ibc/vibc-core-smart-contracts/v2@${{ steps.version.outputs.release }}
- name: Update NPM Registry
run: |
npm ci
npm publish --provenance --access public
bun install --frozen-lockfile
bun run build
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Update Go Registry
run: |
( cd ./bindings && \
GOPROXY=proxy.golang.org go list \
-m github.com/open-ibc/vibc-core-smart-contracts/bindings@${{ steps.version.outputs.release }} )
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ src/contracts.template.ts
forge-cache/

node_modules
package-lock.json
.env
coverage
coverage.json
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ src/contracts.template.ts
.direnv/
forge-cache/

bun.lockb
node_modules
.env
coverage
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ abigen: extract_artifacts
echo "Generating Go vIBC bindings..."; \
for abi_file in $(wildcard $(TMP_ABI_DIR)/*.json); do \
abi_base=$$(basename $$abi_file); \
type=$$(basename $$abi_file .json | tr "[:upper:]" "[:lower:]"); \
type=$$(basename $$abi_file .json); \
pkg=$$(basename $$abi_base .json | tr "[:upper:]" "[:lower:]"); \
mkdir -p ./bindings/$$pkg; \
abigen --abi $$abi_file --pkg $$pkg --type $$type --out ./bindings/$$pkg/$$type.go; \
done
done; \
( cd ./bindings && go mod tidy )

clean:
echo "Cleaning up all artifacts..."; \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion bindings/go.mod → go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/open-ibc/vib-core-smart-contracts/bindings
module github.com/open-ibc/vibc-core-smart-contracts/v2

go 1.21

Expand Down
File renamed without changes.
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,31 @@
},
"license": "MIT",
"dependencies": {
"@commander-js/extra-typings": "^12.0.1",
"@typechain/ethers-v6": "^0.5.0",
"ethers": "^6.7.1",
"@commander-js/extra-typings": "^12.1.0",
"@typechain/ethers-v6": "^0.5.1",
"ethers": "^6.13.1",
"nunjucks": "^3.2.4",
"solhint": "^5.0.1",
"typechain": "^8.3.2",
"winston": "^3.13.0",
"yaml": "^2.4.1",
"yaml": "^2.4.5",
"yargs": "^17.7.2",
"zod": "^3.23.4",
"zx": "^8.0.2"
"zod": "^3.23.8",
"zx": "^8.1.3"
},
"devDependencies": {
"@types/nunjucks": "^3.2.6",
"@types/winston": "^2.4.4",
"@types/yargs": "^17.0.32",
"chai": "^5.1.1",
"solidity-coverage": "^0.8.0",
"tsup": "^8.0.2"
"solidity-coverage": "^0.8.12",
"tsup": "^8.1.0"
},
"scripts": {
"lint": "solhint contracts/**/*.sol",
"test": "forge test",
"build": "npm run build-ts-contract-bindings && npm run build-go-contract-bindings && tsup",
"build-ts-contract-bindings": "npm run build-contracts && typechain --target ethers-v6 --out-dir src/evm/contracts/ './out/?(OptimisticProofVerifier|ProofVerifier|Ibc|IbcUtils|Channel|Dispatcher|Mars|Earth|UniversalChannelHandler|DummyProofVerifier|DummyLightClient|ERC1967Proxy|OptimisticLightClient).sol/*.json'",
"build-go-contract-bindings": "make abigen clean && (cd ./bindings && go mod tidy)",
"build-go-contract-bindings": "make abigen clean",
"build-contracts": "forge build",
"deploy-contracts": "npm run build && node dist/deploy.js",
"deploy-simple": "node dist/deploy.js",
Expand Down

0 comments on commit a4481d6

Please sign in to comment.