-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (47 loc) · 1.92 KB
/
main.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
name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag threefoldjimber/threefold-connect-news:${{ github.sha }}
- name: Log into GitHub Container Registry
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Push to dockerhub
run: docker push threefoldjimber/threefold-connect-news:${{ github.sha }}
- name: Push latest to dockerhub
run: |
docker tag threefoldjimber/threefold-connect-news:${{ github.sha }} threefoldjimber/threefold-connect-news:latest
docker push threefoldjimber/threefold-connect-news:latest
# deploy:
# needs: [build]
# runs-on: whale-replacement
# steps:
# - name: remove current running container
# run: docker rm -f threefold-connect-news
# - name: run container
# run: docker run -d --restart unless-stopped --name threefold-connect-news --network 3proxynet threefoldjimber/threefold-connect-news:${{ github.sha }}
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create kubeconfig
run: |
mkdir ${HOME}/.kube
echo ${{ secrets.KUBE_KEY }} | base64 --decode > ${HOME}/.kube/jimber-prod2.key
echo ${HOME}/.kube/jimber-prod2.key
echo ${{ secrets.KUBE_CRT }} | base64 --decode > ${HOME}/.kube/jimber-prod2.crt
echo ${HOME}/.kube/jimber-prod2.crt
- name: context
run: |
echo ${{ secrets.KUBE_CONFIG }} | base64 --decode > ${HOME}/.kube/config
cat ${HOME}/.kube/config
- name: deploy to kubernetes
run: helm upgrade news helm_files --set image.tag=${{ github.sha }} -n jimber