Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinacolt committed Sep 16, 2024
1 parent 953e109 commit ef01193
Show file tree
Hide file tree
Showing 38 changed files with 1,111 additions and 627 deletions.
407 changes: 0 additions & 407 deletions .github/workflows/checks.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/docker_hive.yml

This file was deleted.

94 changes: 0 additions & 94 deletions .github/workflows/hive.yml

This file was deleted.

150 changes: 150 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Publish

on:
workflow_dispatch:
inputs:
release:
description: 'Release Version'
required: true
type: string
service:
description: 'Service to Publish'
required: true
type: choice
options:
- full-node
- prover
- sequencer
environment:
description: 'Environment to Publish'
required: true
type: choice
options:
- Dev-Net
- Test-Net
- Main-Net

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-and-push:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check and Download Citrea binary
run: |
sudo apt update
sudo apt -y install wget
RELEASE="${{ github.event.inputs.release }}"
PLATFORM="linux-amd64"
SERVICE="${{ github.event.inputs.service }}"
REPO="chainwayxyz/citrea"
BINARY_NAME="citrea"
BINARY_URL="https://github.com/${REPO}/releases/download/${RELEASE}/citrea-${RELEASE}-${PLATFORM}"
echo "Downloading binary from ${BINARY_URL}"
# Download the binary using wget
wget -O devops/${SERVICE}/citrea "${BINARY_URL}"
# Make the downloaded file executable
chmod +x devops/${SERVICE}/citrea
chmod +x devops/${SERVICE}/run.sh


- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
env:
ECR_REPOSITORY: citrea-${{ github.event.inputs.service }}-repository
IMAGE_TAG: ${{ github.event.inputs.release }}
with:
file: ./devops/${{ github.event.inputs.service }}/Dockerfile
context: ./devops/${{ github.event.inputs.service }}
tags: ${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
platforms: linux/amd64
push: false
load: true

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.CORE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.CORE_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr-core-us-east-1
uses: aws-actions/amazon-ecr-login@v2

- name: Tag latest and push image to Amazon ECR
id: push-image-to-us-east-1
env:
ECR_REGISTRY: ${{ steps.login-ecr-core-us-east-1.outputs.registry }}
ECR_REPOSITORY: citrea-${{ github.event.inputs.service }}-repository
IMAGE_TAG: ${{ github.event.inputs.release }}
run: |
docker tag ${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
docker tag ${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.POP_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.POP_AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-1

- name: Login to Amazon ECR
id: login-ecr-pop-ap-southeast-1
uses: aws-actions/amazon-ecr-login@v2

- name: Tag latest and push image to Amazon ECR
id: push-image-to-ap-southeast-1
env:
ECR_REGISTRY: ${{ steps.login-ecr-pop-ap-southeast-1.outputs.registry }}
ECR_REPOSITORY: citrea-${{ github.event.inputs.service }}-repository
NEW_ECR_REPOSITORY: ap-southeast-1-test-net-citrea-full-node-repository
IMAGE_TAG: ${{ github.event.inputs.release }}
run: |
docker tag ${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:latest
docker tag ${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:latest
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.POP_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.POP_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1

- name: Login to Amazon ECR
id: login-ecr-pop-eu-central-1
uses: aws-actions/amazon-ecr-login@v2

- name: Tag latest and push image to Amazon ECR
id: push-image-eu-central-1
env:
ECR_REGISTRY: ${{ steps.login-ecr-pop-eu-central-1.outputs.registry }}
ECR_REPOSITORY: citrea-${{ github.event.inputs.service }}-repository
NEW_ECR_REPOSITORY: eu-central-1-test-net-citrea-full-node-repository
IMAGE_TAG: ${{ github.event.inputs.release }}
run: |
docker tag ${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:latest
docker tag ${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.NEW_ECR_REPOSITORY }}:latest
Loading

0 comments on commit ef01193

Please sign in to comment.