-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (78 loc) · 2.93 KB
/
develop.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: develop-fluxer
on:
push:
branches:
- "develop"
env:
REGISTRY: gcr.io/xxcloud/fluxer
PROJECT: fluxer
IMAGE: develop
DEPLOYMENT: fluxer
# NEXT env
# NEXT_PUBLIC_API_URL: ${{ secrets.DEV_NEXT_PUBLIC_API_URL }}
# NEXT_PUBLIC_FIREBASE: ${{ secrets.DEV_NEXT_PUBLIC_FIREBASE }}
# NEXT_PUBLIC_AMPLITUDE_KEY: ${{ secrets.DEV_NEXT_PUBLIC_AMPLITUDE_KEY }}
# NEXT_PUBLIC_GOOGLE_MAPS: ${{ secrets.DEV_NEXT_PUBLIC_GOOGLE_MAPS }}
# NEXT_PUBLIC_MAPBOX_TOKEN: ${{ secrets.DEV_NEXT_PUBLIC_MAPBOX_TOKEN }}
# NEXT_PUBLIC_PAYMENT_GATEWAY: ${{ secrets.DEV_NEXT_PUBLIC_PAYMENT_GATEWAY }}
# NEXT_PUBLIC_STRIPE_PUBLIC: ${{ secrets.DEV_NEXT_PUBLIC_STRIPE_PUBLIC }}
K8S_CONFIG: ${{ secrets.K8S_CONFIG }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GKE_ZONE: ${{ secrets.GKE_ZONE }}
GKE_SA_KEY: ${{ secrets.GKE_SA_KEY }}
jobs:
setup-build-publish-deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(git rev-parse --short HEAD)"
- name: Login to GCR
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GKE_SA_KEY }}
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: ${{ env.REGISTRY }}:${{ env.PROJECT }}-${{ env.IMAGE }}-${{ steps.slug.outputs.sha7 }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
platforms: linux/arm64/v8
build-args: |
GITHUB_SHA=${{ github.sha }}
GITHUB_REF=${{ github.ref }}
NPM_AUTH_TOKEN=${{ env.NPM_AUTH_TOKEN }}
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
# - name: Set up k8s
# run: sudo snap install kubectl --classic
# # Get the cluster credentials so we can deploy to the cluster
# - name: Save Kubernetes Configuration
# run: mkdir -p $HOME/.kube/ && echo "$K8S_CONFIG" > $HOME/.kube/config && chmod +x $HOME/.kube/config
# # Deploy the Docker image to the GKE cluster
# - name: Deploy/Update new Image to Kubernetes
# run: kubectl set image deployment/$DEPLOYMENT $DEPLOYMENT=$REGISTRY:$PROJECT-$IMAGE-${GITHUB_SHA:0:7}