15
15
build :
16
16
name : Build Server Project
17
17
runs-on : ubuntu-latest
18
+ if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
18
19
steps :
19
20
- uses : actions/checkout@v2
20
21
- name : Use Node.js 12.x
@@ -36,23 +37,18 @@ jobs:
36
37
with :
37
38
path : ./
38
39
- name : Set up QEMU
39
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
40
40
uses : docker/setup-qemu-action@v1
41
41
- name : Set up Docker Buildx
42
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
43
42
uses : docker/setup-buildx-action@v1
44
43
- name : Login to DockerHub
45
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
46
44
uses : docker/login-action@v1
47
45
with :
48
46
username : ${{ secrets.DOCKERHUB_USERNAME }}
49
47
password : ${{ secrets.DOCKERHUB_TOKEN }}
50
48
- name : Set git sha
51
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
52
49
id : git-sha
53
50
run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
54
51
- name : Build snapshot with git sha and push on merge
55
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
56
52
id : docker_build_snapshot_merge
57
53
uses : docker/build-push-action@v2
58
54
with :
61
57
push : true
62
58
tags : greenstand/treetracker-wallet-api:${{ steps.package-version.outputs.current-version }}-${{ steps.git-sha.outputs.sha_short }}
63
59
- name : Build snapshot and push on merge
64
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
65
60
id : docker_build_merge
66
61
uses : docker/build-push-action@v2
67
62
with :
@@ -91,16 +86,24 @@ jobs:
91
86
name : Deploy latest to development environment
92
87
runs-on : ubuntu-latest
93
88
needs : release
89
+ if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
94
90
steps :
95
91
- uses : actions/checkout@v2
92
+ - name : Set git sha
93
+ id : git-sha
94
+ run : echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
95
+ - name : Build snapshot with git sha and push on merge
96
+ - name : Install kustomize
97
+ run : curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
98
+ - name : Copy kustomize.yml
99
+ run : cp deployment/kustomize/kustomization.yml deployment/kustomization.yml
100
+ - name : Run kustomize
101
+ run : (cd deployment && ../kustomize edit set image greenstand/treetracker-wallet-api:${{ steps.git-sha.outputs.sha_short }} )
96
102
- name : Install doctl for kubernetes
97
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
98
103
uses : digitalocean/action-doctl@v2
99
104
with :
100
105
token : ${{ secrets.DIGITALOCEAN_TOKEN }}
101
106
- name : Save DigitalOcean kubeconfig
102
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
103
107
run : doctl kubernetes cluster kubeconfig save ${{ secrets.CLUSTER_NAME }}
104
108
- name : Update kubernetes resources
105
- if : github.event_name == 'push' && github.repository == 'Greenstand/treetracker-wallet-api'
106
- run : kubectl -n development delete -f ./deployment/ && kubectl -n development apply --wait -f ./deployment/
109
+ run : kubectl -n development apply --wait -k ./deployment/
0 commit comments