-
Notifications
You must be signed in to change notification settings - Fork 40
86 lines (75 loc) · 2.6 KB
/
staging-docs.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
name: Build and Deploy Staging Docs
on:
push:
branches:
- staging
# Environment variables available to all jobs and steps in this workflow
env:
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }}
GKE_ZONE: ${{ secrets.GKE_ZONE }}
jobs:
setup-build-publish-deploy:
name: Setup, Build, and Deploy
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@master
# - name: get commit message
# run: |
# echo "commitmsg=\"$(git log --format=%B -n 1 3176eca6763c3d3e042efd962b5fb48f1fce0481)\"" >> $GITHUB_ENV
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.82.0'
extended: true
- name: Setup gcloud CLI
uses: google-github-actions/setup-gcloud@v0
with:
version: '281.0.0'
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
export_default_credentials: true
- name: Build
run: hugo
- name: Deploy
run: |
gcloud auth configure-docker
gcloud container clusters get-credentials $GKE_CLUSTER \
--zone $GKE_ZONE --project $GKE_PROJECT
kubectl -n webroot rollout restart deployment user-docs-merge-staging
kubectl -n webroot get pod -o wide
# - name: Notify
# run: |
# sha_short=$(echo ${{ github.sha }} | cut -c -6)
# curl -X POST ${{ secrets.SLACK_WEBHOOK }} -d "
# {
# \"blocks\": [
# {
# \"type\": \"section\",
# \"text\": {
# \"text\": \"Documentation[$BRANCH_NAME] is updated.\",
# \"type\": \"mrkdwn\"
# },
# \"fields\": [
# {
# \"type\": \"mrkdwn\",
# \"text\": \"branch: <https://github.com/${{ github.repository }}/tree/$BRANCH_NAME|$BRANCH_NAME>\"
# },
# {
# \"type\": \"mrkdwn\",
# \"text\": \"author: ${{ github.actor }}\"
# },
# {
# \"type\": \"mrkdwn\",
# \"text\": \"commit: $commitmsg <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|$sha_short>\"
# }
# ]
# }
# ]
# }
# "