diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..54fcc95 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,42 @@ +name: Build new image for operations + +on: + push: + tags: + - v* +env: + IMAGE_NAME: registrator + +jobs: + push: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v3 + + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + + - name: Log in to registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Push image + run: | + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + # Strip git ref prefix from version + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # Strip "v" prefix from tag name + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # Use Docker `latest` tag convention + [ "$VERSION" == "main" ] && VERSION=staging + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION diff --git a/operations/registrator-deploy-dev-goerli.hcl b/operations/registrator-deploy-dev-goerli.hcl index 63aab62..ecf62d2 100644 --- a/operations/registrator-deploy-dev-goerli.hcl +++ b/operations/registrator-deploy-dev-goerli.hcl @@ -28,7 +28,6 @@ job "registrator-deploy-dev-goerli" { CONSUL_TOKEN="{{.Data.data.CONSUL_TOKEN}}" JSON_RPC="{{.Data.data.JSON_RPC}}" REGISTRATOR_OPERATOR_ADDRESS="{{.Data.data.REGISTRATOR_OPERATOR_ADDRESS}}" - REGISTRATOR_RECEIVER_ADDRESS="{{.Data.data.REGISTRATOR_RECEIVER_ADDRESS}}" {{end}} EOH destination = "secrets/file.env" diff --git a/scripts/deploy.ts b/scripts/deploy.ts index 7fa77a6..c70098f 100755 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -33,17 +33,17 @@ async function main() { : owner const operatorAddress = process.env.REGISTRATOR_OPERATOR_ADDRESS || '0x90F79bf6EB2c4f870365E785982E1f101E93b906' // Hardhat #3 - const receiverAddress = process.env.REGISTRATOR_RECEIVER_ADDRESS || '0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65' // Hardhat #4 console.log(`Deploying registrator with operator ${operatorAddress}...`) - console.log(`Deploying registrator with receiver ${receiverAddress}...`) console.log(`Deploying registrator with deployer ${deployer.address}...`) const Contract = await ethers.getContractFactory('Registrator', deployer) + + const defaultBlockLock = 5n * 60n * 24n * 180n // 12s per block, 180 days const instance = await upgrades.deployProxy( Contract, - [ atorContractAddress, operatorAddress, receiverAddress ] + [ atorContractAddress, operatorAddress, defaultBlockLock ] ) await instance.waitForDeployment() const proxyContractAddress = await instance.getAddress()