-
Notifications
You must be signed in to change notification settings - Fork 11
88 lines (74 loc) · 2.62 KB
/
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
name: deploy
on:
push:
branches: [ 2024 ]
pull_request:
branches: [ 2024 ]
env:
REGISTRY: hub.oepkgs.net
IMAGE_NAME: summer-ospp/help
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- run: pip install -r requirements.txt
- run: mkdocs build --strict --verbose
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.OEPKGS_USERNAME }}
password: ${{ secrets.OEPKGS_PASSWORD }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ github.sha }}
- name: Build and push Docker image
id: push-meta
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Extract Docker metadata
id: metb
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ github.GITHUB_REF }}
- name: Build and push Docker image
id: push-metb
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metb.outputs.tags }}
labels: ${{ steps.metb.outputs.labels }}
- name: Deploy in Huawei CCE
if: github.event_name != 'pull_request'
uses: summer-ospp/[email protected]
env:
SHA: ${{ github.sha }}
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script_stop: true
envs: SHA,IMAGE
script: |
SHA=$SHA;IMAGE=$IMAGE;kubectl set image deployment/summer2024-help summer2024-help=$IMAGE:$SHA -n summer2024;
sleep 20
kubectl get pod -n summer2024