-
Notifications
You must be signed in to change notification settings - Fork 5
72 lines (70 loc) · 2.69 KB
/
build-push-devnet.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build-Deploy-devnet
on:
push:
branches: [develop,fix_ci]
jobs:
docker-build:
# Name the Job
name: Build
runs-on: build
outputs:
repository: ${{ steps.build.outputs.repository }}
image_tag: ${{ steps.build.outputs.image_tag }}
steps:
- uses: actions/checkout@v2
- name: Configure AWS credentials
id: checkout
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to AWS ECR
id: build
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: account-sponsor
IMAGE_TAG: ${{github.sha}}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=repository::$ECR_REPOSITORY"
echo "::set-output name=image_tag::$IMAGE_TAG"
deploy:
name: Deploy via Helmfile
runs-on: deployer
needs: docker-build
container:
image: quay.io/roboll/helmfile:v0.142.0
steps:
- name: Configure AWS credentials
id: checkout
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Check out velas-infra
uses: actions/checkout@master
with:
repository: velas/velas-infra
token: ${{ secrets.INFRA_PULL_TOKEN }}
- name: Sops Binary Installer
uses: mdgreenwald/[email protected]
- uses: prepor/action-aws-iam-authenticator@master
- name: Deploy via helmfile
id: deploy
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ needs.docker-build.outputs.repository }}
IMAGE_TAG: ${{ needs.docker-build.outputs.image_tag }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
run: |
helm plugin install https://github.com/jkroepke/helm-secrets --version v3.11.0 || true
helm plugin install https://github.com/databus23/helm-diff || true
mkdir -p ~/.kube && echo $KUBE_CONFIG_DATA|base64 -d > ~/.kube/config
cd deploy
helmfile -e prod-eu-monster1 -l namespace=devnet,name=velas-account-sponsor apply --set image.tag=$IMAGE_TAG --skip-deps