Skip to content

update

update #13

Workflow file for this run

name: Deployment
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
jobs:
Deploy-to-main:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Foundry PreSetup
uses: actions/checkout@v3
env:
FOUNDRY_PROFILE: ci
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.63.0
target: wasm32-unknown-unknown
override: true
- name: Install wasm-opt
run: sudo apt update && sudo apt install -y binaryen clang
- name: Build Secret gateway contract
run: cd TNLS-Gateways/secret/ && make build-mainnet
- name: Build Secret sample contract
run: cd TNLS-Gateways/secret/tests/example-private-contract && make build-mainnet
- name: Install dependencies
run: npm --prefix secret-deploy/ install
- name: Create .env file for Node
env:
MNEMONIC: ${{ secrets.SECRET_WALLET_MNEMONIC }}
run: |
touch secret-deploy/.env
echo MNEMONIC="$MNEMONIC" >> secret-deploy/.env
echo GRPC_WEB_URL='"https://grpc.testnet.secretsaturn.net"' >> secret-deploy/.env
echo CHAIN_ID='"pulsar-3"' >> secret-deploy/.env
cat secret-deploy/.env
- name: Deploy Secret contracts
working-directory: ./secret-deploy
run: npx ts-node deploy.ts
- name: Get Secret contract details
run: |
echo "SECRET_GATEWAY_CODE_HASH=$(sed -n '2{p;q}' secret-deploy/secret_gateway.log)" >> $GITHUB_ENV
echo "SECRET_GATEWAY_ADDRESS=$(sed -n '3{p;q}' secret-deploy/secret_gateway.log)" >> $GITHUB_ENV
echo "SECRET_GATEWAY_ENCRYPTION_KEY=$(sed -n '4{p;q}' secret-deploy/secret_gateway.log)" >> $GITHUB_ENV
echo "SECRET_GATEWAY_ETH_ADDRESS=$(sed -n '5{p;q}' secret-deploy/secret_gateway.log)" >> $GITHUB_ENV
echo "SECRET_SAMPLE_CODE_HASH=$(sed -n '2{p;q}' secret-deploy/secret_sample.log)" >> $GITHUB_ENV
echo "SECRET_SAMPLE_ADDRESS=$(sed -n '3{p;q}' secret-deploy/secret_sample.log)" >> $GITHUB_ENV
- name: Update config.yml with Secret info
run: |
sed -i 's;INSERT_SECRET_CONTRACT_ADDRESS_HERE;${{ env.SECRET_GATEWAY_ADDRESS }};g' config.yml
sed -i 's;INSERT_SECRET_CONTRACT_ENCRYPTION_KEY_HERE;${{ env.SECRET_GATEWAY_ENCRYPTION_KEY }};g' config.yml
sed -i 's;INSERT_SECRET_CONTRACT_ETH_ADDRESS_HERE;${{ env.SECRET_GATEWAY_ETH_ADDRESS }};g' config.yml
cat config.yml
git config --global user.email "[email protected]"
git config --global user.name "Leor Fishman"
git commit -am "Update config.yml with Secret info"
- name: Install jq
run: sudo apt update && sudo apt install -y jq
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
working-directory: ./public-gateway
run: |
forge --version
forge build --sizes
id: build
- name: Run Forge tests
working-directory: ./public-gateway
run: |
forge test -vvv
id: test
- name: Deploy Procedure
working-directory: ./public-gateway
env:
INFURA_API_URL: ${{secrets.INFURA_API_URL}}
ETH_PRIVATE_KEY: ${{secrets.ETH_PRIVATE_KEY}}
ETHERSCAN_KEY: ${{secrets.ETHERSCAN_KEY}}
SECRET_GATEWAY_ETH_ADDRESS: ${{env.SECRET_GATEWAY_ETH_ADDRESS}}
run: |
forge script script/DeployScript.s.sol:DeployScript --rpc-url "$INFURA_API_URL" --private-key "$ETH_PRIVATE_KEY" --etherscan-api-key "$ETHERSCAN_KEY" --broadcast --verify --retries 10 -vvvv
echo "ETH_GATEWAY_ADDRESS=$(jq -r '.transactions[1].contractAddress' /home/runner/work/TNLS/TNLS/public-gateway/broadcast/DeployScript.s.sol/5/run-latest.json)" >> $GITHUB_ENV
echo "ETH_CLIENT_ADDRESS=$(jq -r '.transactions[2].contractAddress' /home/runner/work/TNLS/TNLS/public-gateway/broadcast/DeployScript.s.sol/5/run-latest.json)" >> $GITHUB_ENV
- name: Update config.yml with Ethereum Contract info
run: |
sed -i 's;INSERT_ETHEREUM_CONTRACT_ADDRESS_HERE;${{ env.ETH_GATEWAY_ADDRESS }};g' config.yml
cat config.yml
git config --global user.email "[email protected]"
git config --global user.name "Leor Fishman"
git commit -am "Update config.yml with Ethereum contract info"
- name: Deploy webserver to heroku
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "atbash-demo-server"
heroku_email: ${{ secrets.HEROKU_EMAIL }}