Skip to content

Commit 3bb9925

Browse files
avs51sokolov.a
andauthored
Add deploy action (#261)
* Add deploy workflow * fix deploy workflow * fix deploy workflow * fix deploy workflow * test deploy * revert test deploy * add prod deploy * add deploy actions * change prod deploy --------- Co-authored-by: sokolov.a <sokolov.a@selectel.ru>
1 parent bd7f199 commit 3bb9925

2 files changed

Lines changed: 128 additions & 0 deletions

File tree

.github/workflows/dev-deploy.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build docs
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- "master"
7+
tags-ignore:
8+
- "*"
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
name: Build Sphinx docs
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5.0.0
19+
20+
- name: Set Python
21+
uses: actions/setup-python@v6.0.0
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Install dependencies
26+
run: |
27+
pip install -r docs/requirements.txt
28+
29+
- name: Build static files
30+
run: |
31+
cd docs
32+
make html
33+
34+
- name: Upload build artifact
35+
uses: actions/upload-artifact@v5.0.0
36+
with:
37+
name: docs-html
38+
path: docs/_build/html
39+
40+
deploy:
41+
name: Deploy to docs.dev.joinrpg.ru S3
42+
needs: build
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- name: Download built HTML
47+
uses: actions/download-artifact@v6.0.0
48+
with:
49+
name: docs-html
50+
path: build_html
51+
52+
- name: Set up S3cmd cli tool
53+
uses: s3-actions/s3cmd@v2.0.1
54+
with:
55+
provider: yandex
56+
region: ru-central1
57+
access_key: ${{ secrets.SYNC_ACCESS_ID }}
58+
secret_key: ${{ secrets.SYNC_ACCESS_SECRET }}
59+
60+
- name: sync to s3
61+
run: |
62+
cd build_html
63+
s3cmd sync --recursive --exclude "*.css" --exclude "*.js" * s3://docs.dev.joinrpg.ru
64+
s3cmd sync --recursive --include "*.css" * --mime-type="text/css" s3://docs.dev.joinrpg.ru
65+
s3cmd sync --recursive --include "*.js" * --mime-type="application/javascript" s3://docs.dev.joinrpg.ru

.github/workflows/prod-deploy.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: Build Sphinx docs
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5.0.0
17+
18+
- name: Set Python
19+
uses: actions/setup-python@v6.0.0
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install dependencies
24+
run: |
25+
pip install -r docs/requirements.txt
26+
27+
- name: Build static files
28+
run: |
29+
cd docs
30+
make html
31+
32+
- name: Upload build artifact
33+
uses: actions/upload-artifact@v5.0.0
34+
with:
35+
name: docs-html
36+
path: docs/_build/html
37+
38+
deploy:
39+
name: Deploy to docs.joinrpg.ru S3
40+
needs: build
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Download built HTML
45+
uses: actions/download-artifact@v6.0.0
46+
with:
47+
name: docs-html
48+
path: build_html
49+
50+
- name: Set up S3cmd cli tool
51+
uses: s3-actions/s3cmd@v2.0.1
52+
with:
53+
provider: yandex
54+
region: ru-central1
55+
access_key: ${{ secrets.SYNC_ACCESS_ID }}
56+
secret_key: ${{ secrets.SYNC_ACCESS_SECRET }}
57+
58+
- name: sync to s3
59+
run: |
60+
cd build_html
61+
s3cmd sync --recursive --exclude "*.css" --exclude "*.js" * s3://docs.joinrpg.ru
62+
s3cmd sync --recursive --include "*.css" * --mime-type="text/css" s3://docs.joinrpg.ru
63+
s3cmd sync --recursive --include "*.js" * --mime-type="application/javascript" s3://docs.joinrpg.ru

0 commit comments

Comments
 (0)