forked from blockscout/frontend
-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (46 loc) · 1.65 KB
/
build-push-rollout.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
on:
push:
branches:
- 'staging-harmony'
name: Docker build and push
jobs:
push:
name: Docker build and push
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.STG_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STG_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Prepare image tag
shell: bash
run: |
echo "IMAGE_TAG=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Build and push
env:
AWS_ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
AWS_ECR_REPOSITORY: bs-frontend
run: |
docker build -t $AWS_ECR_REGISTRY/$AWS_ECR_REPOSITORY:${{ env.IMAGE_TAG }} -t $AWS_ECR_REGISTRY/$AWS_ECR_REPOSITORY:latest --build-arg GIT_COMMIT_SHA=${{ env.IMAGE_TAG }} --build-arg GIT_TAG=${{ github.ref_type == 'tag' && github.ref_name || '' }} -f Dockerfile .
docker push $AWS_ECR_REGISTRY/$AWS_ECR_REPOSITORY --all-tags
rollout:
name: K8s rollout
needs: push
runs-on: ubuntu-latest
steps:
- uses: azure/setup-kubectl@v3
id: install
- uses: azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.STG_HARMONY_TESTNET_KUBECONFIG }}
- name: Restart deployment
run: |
kubectl rollout restart deployment/bs-frontend-frontend