Skip to content

Commit

Permalink
Deploy updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kanshi committed Jan 25, 2024
1 parent 9f54bf7 commit 327e8bc
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion operations/registrator-deploy-dev-goerli.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 327e8bc

Please sign in to comment.