Skip to content

Commit

Permalink
added CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sorXCode committed Aug 2, 2022
1 parent 4a3c072 commit 663334c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export NETWORK=mainnet

TESTNET_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
MAINNET_URL=""
CHAIN_ID=
47 changes: 47 additions & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is a basic workflow to help you get started with Actions

name: nb-sandbox-contracts

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
IMAGE_TAG: ${{ github.sha }}
ECR_REPOSITORY: nb-sandbox-contracts
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-and-push-to-ecr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.PRODUCTS_ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PRODUCTS_ECR_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY -a
- name: Send Slack Notification
id: slack
uses: slackapi/[email protected]
with:
# This data can be any valid JSON from a previous step in the GitHub Action
payload: |
{
"repository": "${{github.repository}}",
"docker_tag": "${{env.IMAGE_TAG}}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_WEBHOOK }}
4 changes: 1 addition & 3 deletions docker/deploy.sh → docker/deploy_CBToken.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh
# Change to the correct directory
cd /usr/src/app;
# Compile contracts
npm run compile;
# Deploy contract
npm run deploy;
npm run deploy_CBToken;
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const config: HardhatUserConfig = {
solidity: "0.8.4",
networks: {
mainnet: {
chainId: parseInt(process.env.CHAIN_ID ?? "0"),
url: process.env.MAINNET_URL || "",
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
"name": "nb-sandbox-token",
"scripts": {
"compile": "hardhat compile",
"deploy_CBToken:testnet": "hardhat run scripts/deploy.ts --network testnet",
"deploy_CBToken:mainnet": "hardhat run scripts/deploy.ts --network mainnet",
"deploy_disperse:testnet": "hardhat run scripts/disperse.ts --network testnet",
"deploy_dispers:mainnet": "hardhat run scripts/disperse.ts --network mainnet",
"deploy_CBToken": "hardhat run scripts/deploy.ts --network $NETWORK",
"deploy_disperse": "hardhat run scripts/disperse.ts --network $NETWORK",
"test": "hardhat test"
},
"devDependencies": {
Expand Down

0 comments on commit 663334c

Please sign in to comment.