Skip to content

Commit

Permalink
chore: adding Build and deploy VC-API workflow (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
artursudnik committed Oct 16, 2023
1 parent c0120fc commit b206df3
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/deploy-vc-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build and deploy VC-API

on: [workflow_dispatch]

jobs:
cancel-previous:
name: 'Cancel Previous Runs'
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

install-build-and-push:
runs-on: ubuntu-latest
needs: [cancel-previous]
steps:
- name: Check out vc-api-owf
run: |
git clone https://github.com/energywebfoundation/vc-api-owf
- name: Configure AWS credentials IDC
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

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

- name: Getting GIT SHA value
id: get-git-sha
working-directory: ./vc-api-owf
run: echo "git-sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Build Docker image
working-directory: ./vc-api-owf
env:
ECR_REGISTRY: ${{ steps.login-ecr-ssi.outputs.registry }}
AWS_ECR_REPOSITORY_SSI: ${{ secrets.DEV_ECR_REPOSITORY }}
GIT_SHA: ${{ steps.get-git-sha.outputs.git-sha }}
run: |
docker build \
-t $ECR_REGISTRY/$AWS_ECR_REPOSITORY_SSI:$GIT_SHA \
-f apps/vc-api/Dockerfile .
- name: Push Docker image
working-directory: ./vc-api-owf
env:
ECR_REGISTRY: ${{ steps.login-ecr-ssi.outputs.registry }}
AWS_ECR_REPOSITORY_SSI: ${{ secrets.DEV_ECR_REPOSITORY }}
GIT_SHA: ${{ steps.get-git-sha.outputs.git-sha }}
run: |
docker push \
$ECR_REGISTRY/$AWS_ECR_REPOSITORY_SSI:$GIT_SHA
- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr-idc.outputs.registry }}


- name: ARGO CD LOGIN
uses: clowdhaus/argo-cd-action/@v1.9.0
id: argocd_login_ssi
with:
command: login ${{ secrets.DEV_ARGOCD_URL }}
options: --insecure --password ${{ secrets.DEV_ARGOCD_PASS }} --username ${{ secrets.DEV_ARGOCD_USERNAME }}

- name: ArgoCD overvrite SSI values.yaml
uses: clowdhaus/argo-cd-action/@v1.9.0
id: argocd_image_tag_overwrite_ssi
with:
command: app set ssi-wallet
options: -p image.tag=${{ steps.get-git-sha.outputs.git-sha }}

0 comments on commit b206df3

Please sign in to comment.