Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPLEMENTATION]-[TESTNET] Writing Github Actions scripts to auto build our sBTC Components as Containers #93

Open
3 tasks
SundarGowtham opened this issue Apr 30, 2024 · 0 comments
Assignees
Labels
test environment The testing envionment used to develop the sBTC-v1 features.

Comments

@SundarGowtham
Copy link
Collaborator

Scoping the exact requirements and details for writing Github Actions for each of our sBTC Components

[Implementation] - Running ArgoCD

This ticket holds the implementation details required for writing GH Actions workflow files for our sBTC Components. Since we will be using a monorepo, we will have to find a way to have multiple GH workflow files which correctly grabs the sBTC component folder that has changed, build, and push to AWS ECR

Here is a sample workflow file:

name: Build and Deploy to AWS ECR - Testnet

on:
  push:
    branches:
      - development
  workflow_dispatch:

env:
  TAG: ${{ github.sha }}
  COMMITMESSAGE: ${{ github.event.head_commit.message }}
  AWS_REGION: us-east-1
  ECR_REPOSITORY: sbtc-signer

jobs:
  setup-build-publish:
    name: Setup, Build, and Publish
    runs-on: ubuntu-latest
    environment: development

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Configure AWS credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
        aws-region: ${{ env.AWS_REGION }}

    - name: Login to Amazon ECR
      id: login-ecr
      uses: aws-actions/amazon-ecr-login@v1

    # Build the Docker image
    - name: Build
      env:
        CONTAINER_NAME: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:dev-${{ env.TAG }}
      run: |-
        docker build -f dev.Dockerfile -t ${{ env.CONTAINER_NAME }} --build-arg GITHUB_REF=${{ github.ref }} .

    # Push the Docker image to AWS Elastic Container Registry (ECR)
    - name: Publish to ECR
      env:
        CONTAINER_NAME: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:dev-${{ env.TAG }}
      run: |-
        docker push ${{ env.CONTAINER_NAME }}
        echo "image=${{ env.CONTAINER_NAME }}" >> $GITHUB_OUTPUT

This will obviously have to be repurposed to be more intricate to the specific folders where code changes are happening.

This ticket can only be done after we finish our local testnet setup.

External Resources

Closing Checklist

  • The takeaway from this issue is clearly documented in the description of this ticket.
  • Everyone necessary has reviewed the resolution and agrees with the takeaways.
  • This ticket has or links all the information necessary to familiarize a contributor with the topic and how it was resolved.
@SundarGowtham SundarGowtham added the test environment The testing envionment used to develop the sBTC-v1 features. label Apr 30, 2024
@SundarGowtham SundarGowtham self-assigned this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test environment The testing envionment used to develop the sBTC-v1 features.
Projects
None yet
Development

No branches or pull requests

1 participant