-
Notifications
You must be signed in to change notification settings - Fork 43
109 lines (97 loc) · 3.47 KB
/
deploy-branch.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Deploy to dev server
on:
pull_request:
# Cancel workflow runs on PRs when the PR is updated with a newer commit.
# Such runs will have a concurrency group named
# `{github.workflow}-{github.ref}`,
# for example,
# `deploy-branch/refs/add-concurrency`.
#
# Runs on branch `latest` and tags will never be canceled,
# due to having a unique group name
# `{github.run_id}-{github.run_attempt}`,
# for example,
# `3477882280-1`.
concurrency:
group: ${{
(
github.ref == 'refs/heads/latest' ||
startsWith(github.ref, 'refs/tags/')
) &&
format('{0}-{1}', github.run_id, github.run_attempt) ||
format('{0}-{1}', github.workflow, github.ref) }}
cancel-in-progress: true
jobs:
deploy-branch:
runs-on: ubuntu-latest
container: tarantool/doc-builder:fat-4.3
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
S3_ENDPOINT_URL: ${{secrets.S3_ENDPOINT_URL}}
S3_UPLOAD_PATH: ${{secrets.S3_UPLOAD_PATH}}
TARANTOOL_UPDATE_KEY: ${{secrets.TARANTOOL_UPDATE_KEY}}
TARANTOOL_UPDATE_URL: ${{secrets.TARANTOOL_DEVELOP_UPDATE_URL}}
VKTEAMS_BOT_TOKEN: ${{secrets.VKTEAMS_TARANTOOLBOT_TOKEN}}
steps:
- name: Prevent dubious ownership
id: add-safe-directory
run: git config --global --add safe.directory '*'
- uses: actions/checkout@v3
id: checkout
with:
submodules: recursive
- name: Fetch submodules
id: fetch-submodules
run: git fetch --recurse-submodules
- name: Set deployment name from source branch
id: set-deployment-name
run: echo "DEPLOYMENT_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
- name: Start dev server deployment
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
token: ${{secrets.GITHUB_TOKEN}}
env: "branch-${{env.DEPLOYMENT_NAME}}"
ref: ${{github.head_ref}}
- run: cmake .
id: cmake
- run: make pull-modules
id: make-pull-modules
- run: make build-modules
id: make-build-modules
- run: make json
id: make-json
- run: make json-ru
id: make-json-ru
- run: bash upload_output.sh
id: upload-output
- name: Create or update a dev server deployment with version ${{env.DEPLOYMENT_NAME}}
uses: nick-fields/retry@v2
id: update-deployment-webhook
with:
command: bash webhooks/update_deployment.sh
timeout_seconds: 15
retry_wait_seconds: 15
max_attempts: 3
- name: update deployment status
id: finalize-deployment
uses: bobheadxi/deployments@v1
with:
step: finish
token: ${{secrets.GITHUB_TOKEN}}
env: "branch-${{env.DEPLOYMENT_NAME}}"
status: ${{job.status}}
deployment_id: ${{steps.deployment.outputs.deployment_id}}
env_url: ${{secrets.TARANTOOL_HOST}}/doc/${{env.DEPLOYMENT_NAME}}/
- name: Send VK Teams message on failures
# bot token won't be accessible in the forks
if: ${{ failure() && env.VKTEAMS_BOT_TOKEN != '' }}
uses: tarantool/actions/report-job-status@master
with:
api-url: "https://api.internal.myteam.mail.ru/bot/v1/"
bot-token: ${{ env.VKTEAMS_BOT_TOKEN }}
chat-id: tt_docs_cicd_reports
job-steps: ${{ ToJson(steps) }}