generated from energywebfoundation/EWFRepositoryTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adding
Build and deploy VC-API
workflow (#186)
- Loading branch information
1 parent
c0120fc
commit b206df3
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
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,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 }} |