-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (78 loc) · 2.55 KB
/
build-and-deploy.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
name: Build & Deploy Application Container Image
on:
push:
paths-ignore:
- 'docker-compose.yaml'
- 'examples/**'
- 'README.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Yarn install
uses: borales/[email protected]
with:
cmd: install
- name: Yarn tsc
uses: borales/[email protected]
with:
cmd: tsc
- name: Yarn build
uses: borales/[email protected]
with:
cmd: build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: packages/backend/Dockerfile
push: true
tags: chronicc/demo-backstage:latest
cache-from: type=registry,ref=chronicc/demo-backstage:buildcache
cache-to: type=registry,ref=chronicc/demo-backstage:buildcache,mode=max
- name: Update repo description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: chronicc/demo-backstage
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout git repository
uses: actions/checkout@v3
- name: Install helm
uses: azure/setup-helm@v1
id: install
- name: Install chart dependencies
run: ${{ steps.install.outputs.helm-path }} dependency update ./charts/demo-backstage
- name: Write kubeconfig
run: echo "${{ secrets.KUBECONFIG }}" > ./kubeconfig && chmod 600 ./kubeconfig
- name: Write values file
run: echo "${{ secrets.HELM_VALUES }}" > ./values.yaml
- name: Helm deploy
run: ${{ steps.install.outputs.helm-path }} upgrade --install
--create-namespace
--namespace=backstage
--kubeconfig=./kubeconfig
--values=./values.yaml
backstage ./charts/demo-backstage
# test:
# runs-on: ubuntu-latest
# steps:
# - run: echo "${{ secrets.HELM_VALUES_TEST }}" | sed 's/./&/g' > ./values.yaml
# - run: cat ./values.yaml