-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.92 KB
/
publish.yaml
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
# This is a basic workflow to help you get started with Actions
name: Build & Deploy to production
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [main, feat/k8s]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-and-deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: install dependencies
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
chmod +x skaffold
sudo mv skaffold /usr/local/bin
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
- name: create kubeconfig
run: |
mkdir ${HOME}/.kube
cp k8s/config.yaml ${HOME}/.kube/config
cd ${HOME}/.kube
sed -i 's;$KUBE_CLUSTER_NAME;${{ secrets.KUBE_CLUSTER_NAME }};g' config
sed -i 's;$KUBE_CLUSTER_SERVER;${{ secrets.KUBE_CLUSTER_SERVER }};g' config
sed -i 's;$KUBE_CLUSTER_CERTIFICATE;${{ secrets.KUBE_CLUSTER_CERTIFICATE }};g' config
sed -i 's;$KUBE_USER_NAME;${{ secrets.KUBE_USER_NAME }};g' config
sed -i 's;$KUBE_USER_TOKEN;${{ secrets.KUBE_USER_TOKEN }};g' config
kubectl config use-context ${{ secrets.KUBE_CLUSTER_NAME }}
- name: build-and-deploy
run: |
skaffold run --default-repo registry.iteam.pub