Skip to content

Build and deploy VC-API #42

Build and deploy VC-API

Build and deploy VC-API #42

Workflow file for this run

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 }}