Skip to content

Commit 2972aa5

Browse files
committed
Add deployment github action for VA provider
1 parent 6c1a716 commit 2972aa5

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Deploy to dev(auth provider)
2+
on:
3+
push:
4+
branches: [feature/vaccount_auth_provider]
5+
6+
jobs:
7+
docker-build:
8+
# Name the Job
9+
name: Build and push
10+
runs-on: build
11+
outputs:
12+
repository: ${{ steps.build.outputs.repository }}
13+
image_tag: ${{ steps.build.outputs.image_tag }}
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Configure AWS credentials
17+
id: checkout
18+
uses: aws-actions/configure-aws-credentials@v1
19+
with:
20+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
21+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
22+
aws-region: ${{ secrets.AWS_REGION }}
23+
- name: Login to Amazon ECR
24+
id: login-ecr
25+
uses: aws-actions/amazon-ecr-login@v1
26+
- name: Build, tag, and push image to AWS ECR
27+
id: build
28+
env:
29+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
30+
ECR_REPOSITORY: velas-synapse
31+
IMAGE_TAG: ${{github.sha}}
32+
run: |
33+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --no-cache -f docker/Dockerfile .
34+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
35+
echo "::set-output name=repository::$ECR_REPOSITORY"
36+
echo "::set-output name=image_tag::$IMAGE_TAG"
37+
38+
deploy:
39+
name: Deploy via Helmfile
40+
runs-on: deployer
41+
needs: docker-build
42+
container:
43+
image: quay.io/roboll/helmfile:v0.142.0
44+
steps:
45+
- name: Configure AWS credentials
46+
id: checkout
47+
uses: aws-actions/configure-aws-credentials@v1
48+
with:
49+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
50+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
51+
aws-region: ${{ secrets.AWS_REGION }}
52+
- name: Check out velas-infra
53+
uses: actions/checkout@master
54+
with:
55+
repository: velas/velas-infra
56+
token: ${{ secrets.INFRA_PULL_TOKEN }}
57+
- uses: azure/k8s-set-context@v2
58+
with:
59+
method: kubeconfig
60+
kubeconfig: ${{ secrets.KUBE_CONFIG_DATA_AWS_RAW }}
61+
context: "eks_prod-prod"
62+
- name: Sops Binary Installer
63+
uses: mdgreenwald/[email protected]
64+
- uses: prepor/action-aws-iam-authenticator@master
65+
- name: Deploy via helmfile
66+
id: deploy
67+
env:
68+
ECR_REPOSITORY: ${{ needs.docker-build.outputs.repository }}
69+
IMAGE_TAG: ${{ needs.docker-build.outputs.image_tag }}
70+
ECR_REGION: ${{ secrets.AWS_REGION }}
71+
NAMESPACE: devnet
72+
run: |
73+
helm plugin install https://github.com/jkroepke/helm-secrets --version v3.11.0 || true
74+
helm plugin install https://github.com/databus23/helm-diff || true
75+
cd deploy
76+
account_id=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .accountId)
77+
ECR_REGISTRY=${account_id}.dkr.ecr.${ECR_REGION}.amazonaws.com
78+
helmfile -e prod -l namespace=${NAMESPACE},name=velas-synapse-auth-provider apply --set image.tag=$IMAGE_TAG,image.repository=$ECR_REGISTRY/$ECR_REPOSITORY --skip-deps

0 commit comments

Comments
 (0)