-
Notifications
You must be signed in to change notification settings - Fork 14
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
Kostas Demiris
committed
Mar 28, 2024
1 parent
55202c2
commit c3754cf
Showing
4 changed files
with
85 additions
and
396 deletions.
There are no files selected for viewing
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,81 @@ | ||
#name: Deploy V2 holoclis to staging[develop-v2] | ||
# | ||
#permissions: | ||
# id-token: write | ||
# contents: read # This is required for actions/checkout@v2 | ||
# | ||
#env: | ||
# AWS_REGION: us-west-2 | ||
# IAM_ROLE: arn:aws:iam::177635894328:role/Github_role_to_access_ECR | ||
# ECR_REPOSITORY: holo-cli-dev # notice: the same for all cli apps | ||
# # | ||
# IMAGE_TAG: dev-${{ github.sha }} | ||
# # | ||
# CLUSTER_NAME: staging | ||
# # | ||
# AWS_KEY_ID: ${{ secrets.NEWSTAGE_USER_AWS_ACCESS_KEY_ID }} | ||
# AWS_ACCESS_KEY: ${{ secrets.NEWSTAGE_USER_AWS_SECRET_ACCESS_KEY }} | ||
# | ||
#on: | ||
# push: | ||
# branches: | ||
# - 'feat/separate-v1-v2-cli-cicd' | ||
# # Excluded branches | ||
# - '!testnet' | ||
# - '!main' | ||
# - '!mainnet' | ||
# - '!master' | ||
# | ||
#jobs: | ||
# build-the-image: | ||
# name: build-the-image | ||
# runs-on: ubuntu-latest | ||
# | ||
# steps: | ||
- name: Use Githubs federated identity with AWS | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
role-to-assume: ${{ env.IAM_ROLE }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Login to ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Checkout the code | ||
uses: actions/checkout@v2 | ||
|
||
# This is a separate action that sets up buildx runner | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# So now you can use Actions' own caching! | ||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-single-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-single-buildx | ||
# And make it available for builds | ||
- name: Build image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
builder: ${{ steps.buildx.outputs.name }} | ||
file: Dockerfile | ||
build-args: AWS_ECR_URL=${{ steps.login-ecr.outputs.registry }} | ||
platforms: linux/amd64 | ||
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
push: true # set false to deactivate the push to ECR | ||
|
||
# This ugly bit is necessary if you don't want your cache to grow forever until it hits GitHub's limit of 5GB. | ||
# https://github.com/docker/build-push-action/issues/252 & https://github.com/moby/buildkit/issues/1896 | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
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
Oops, something went wrong.