-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 1.74 KB
/
Deploy.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Deploy
on:
push:
branches:
- deploy/*
pull_request:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
KUBECONTENT:
required: true
CONFIG:
required: true
jobs:
deployment:
if: ${{ startsWith(github.ref, 'refs/heads/deployment/') || github.ref == 'refs/heads/main' }}
runs-on: [self-hosted]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Get version
id: version
run: |
if [[ -n "$GITHUB_REF" && "$GITHUB_REF" == "refs/tags/"* ]]; then
echo "tag version"
echo "::set-output name=version::${GITHUB_REF/refs\/tags\//}"
else
echo "commit version"
echo "::set-output name=version::${{ github.sha }}"
fi
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-gnu
- name: Build binary
run: |
echo "${{ secrets.CONFIG }}" >> config.yaml
cargo build --workspace --release
- name: Build and push jzfs-api
run: |
docker build -t gitdatateam/jzfs-api:${{ steps.version.outputs.version }} .
docker push gitdatateam/jzfs-api:${{ steps.version.outputs.version }}
- name: Deploy Api Server
uses: WyriHaximus/github-action-helm3@v3
with:
exec: /usr/sbin/helm upgrade jzfs-api-server --install ./charts --namespace gitdata --set-string tag=${{ steps.version.outputs.version }}
kubeconfig: ${{ secrets.KUBECONTENT }}
overrule_existing_kubeconfig: "true"