-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,111 additions
and
627 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.