Skip to content

Commit 9d361ee

Browse files
committed
Copy build artifacts to S3 after every PR
Add .github/workflows/deploy-branch.yml and upload_output.sh Deploy-branch does not deploy branch and only copy build artifacts Resolves #5
1 parent 75dd18c commit 9d361ee

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflow/deploy-branch.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Deploy-branch
2+
3+
on:
4+
pull_request:
5+
jobs:
6+
deploy-branch:
7+
runs-on: self-hosted
8+
container: tarantool/doc-builder:slim-4.2
9+
env:
10+
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
11+
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
12+
AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}}
13+
S3_ENDPOINT_URL: ${{secrets.S3_ENDPOINT_URL}}
14+
S3_UPLOAD_PATH: ${{secrets.S3_UPLOAD_PATH}}
15+
INTERNALS_UPDATE_URL: ${{secrets.INTERNALS_DEVELOP_UPDATE_URL}}
16+
S3_BUCKET: ${{secrets.S3_BUCKET}}
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set branch name from source branch
21+
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV
22+
23+
- run: make json
24+
- run: bash upload_output.sh

upload_output.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
4+
BRANCH=$BRANCH_NAME
5+
DOC_DEST="$secrets.S3_UPLOAD_PATH/internals/${BRANCH_NAME}"
6+
CHECK_KEY="doc-builds/internals/${BRANCH_NAME}/json/_build_ru/json/toctree.fjson"
7+
8+
aws s3api head-object --bucket ${S3_BUCKET} --key ${CHECK_KEY} --endpoint-url="$ENDPOINT_URL" || not_exist=true
9+
if [ $not_exist ]; then
10+
echo "toctree.json does not exist"
11+
else
12+
echo "found toctree.json, remove the branch from s3 location"
13+
aws s3 rm "$DOC_DEST"/json --endpoint-url="$ENDPOINT_URL" --recursive
14+
fi
15+
16+
aws s3 cp build/json "$DOC_DEST"/json --endpoint-url="$ENDPOINT_URL" --recursive --include "*" --exclude "*.jpg" --exclude "*.png" --exclude "*.svg"

0 commit comments

Comments
 (0)