Merge pull request #96 from Cerebellum-Network/feature/bump-versions #338
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
name: Build and push image to ECR | |
on: | |
push: | |
branches: | |
- dev | |
- master | |
- 'feature/**' | |
- 'release/**' | |
- 'hotfix/**' | |
env: | |
ECR_REPOSITORY: pos-network-node | |
jobs: | |
build-and-push: | |
runs-on: [self-hosted, cere-network-xlarge-workers] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.ORG_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ORG_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build and push image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
run: | | |
image_id=$(docker build . -q -t $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA) | |
echo IMAGE_ID=$image_id >> $GITHUB_ENV | |
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA" | |
docker image tag $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA $ECR_REGISTRY/$ECR_REPOSITORY:latest | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest | |
- name: Copy wasm artifacts from the image | |
run: | | |
container_id=$(docker create ${{ env.IMAGE_ID }}) | |
cere_runtime_artifact_name=cere_runtime.compact.compressed.${GITHUB_SHA:0:7}.wasm | |
echo CERE_RUNTIME_ARTIFACT_NAME=$cere_runtime_artifact_name >> $GITHUB_ENV | |
docker cp $container_id:/home/cere/cere-runtime-artifacts/cere_runtime.compact.compressed.wasm ./$cere_runtime_artifact_name | |
cere_dev_runtime_artifact_name=cere_dev_runtime.compact.compressed.${GITHUB_SHA:0:7}.wasm | |
echo CERE_DEV_RUNTIME_ARTIFACT_NAME=$cere_dev_runtime_artifact_name >> $GITHUB_ENV | |
docker cp $container_id:/home/cere/cere-dev-runtime-artifacts/cere_dev_runtime.compact.compressed.wasm ./$cere_dev_runtime_artifact_name | |
- name: Upload cere-runtime wasm artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.CERE_RUNTIME_ARTIFACT_NAME }} | |
path: ./${{ env.CERE_RUNTIME_ARTIFACT_NAME }} | |
- name: Upload cere-dev-runtime wasm artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.CERE_DEV_RUNTIME_ARTIFACT_NAME }} | |
path: ./${{ env.CERE_DEV_RUNTIME_ARTIFACT_NAME }} |