forked from python/python-docs-pt-br
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (84 loc) · 2.47 KB
/
Copy pathbuild.yml
File metadata and controls
88 lines (84 loc) · 2.47 KB
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
# Build translated docs and notify in case of errors
name: Build
on:
workflow_dispatch:
workflow_call:
secrets:
TELEGRAM_TO:
required: true
TELEGRAM_TOKEN:
required: true
push:
paths:
- '.github/workflows/build.yml'
- 'scripts/build.sh'
- 'scripts/prepmsg.sh'
- '*.po'
- '**/*.po'
env:
CPYTHON_BRANCH: '3.10'
LANGUAGE: 'pt_BR'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get current branch name
shell: bash
run: |
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Check out ${{ github.repository }}
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Check out CPython
uses: actions/checkout@v2
with:
repository: python/cpython
persist-credentials: false
ref: ${{ env.CPYTHON_BRANCH }}
path: cpython
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
sudo apt update -y && sudo apt install gettext -y
pip3 install --upgrade pip
pip3 install -r requirements.txt -r cpython/Doc/requirements.txt
- name: Build docs
run: |
mkdir logs
echo "::add-matcher::.github/problem-matchers/sphinx.json"
sh scripts/build.sh 2> >(tee -a logs/error.log >&2)
env:
LANGUAGE: ${{ env.LANGUAGE }}
- name: Prepare notification on error
if: failure()
run: |
sh scripts/prepmsg.sh logs/error.log logs/notify.log
env:
GITHUB_JOB: ${{ github.job }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Notify via Telegram on build errors if any
if: failure()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
disable_web_page_preview: true
message_file: logs/notify.log
- name: Upload artifact - docs
if: always()
uses: actions/upload-artifact@v2
with:
name: docs
path: cpython/Doc/build/html
- name: Upload artifact - logs
if: always()
uses: actions/upload-artifact@v2
with:
name: build-logs
path: logs/