forked from ansys/pyaedt
-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (94 loc) · 3.79 KB
/
main.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
# This is a basic workflow to help you get started with Actions
name: FullDocumentation
env:
python.version: 3.8
python.venv: 'testvenv'
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
tags:
- v*
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
full_documentation:
# The type of runner that the job will run on
runs-on: Windows
strategy:
matrix:
python-version: [3.8]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
# used for documentation deployment
- name: Get Bot Application Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
with:
application_id: ${{ secrets.BOT_APPLICATION_ID }}
application_private_key: ${{ secrets.BOT_APPLICATION_PRIVATE_KEY }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: 'Create virtual env'
run: |
python -m venv testenv
testenv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: 'Install pyaedt'
run: |
testenv\Scripts\Activate.ps1
pip install -r requirements.txt
pip install -r requirements_docs.txt
Copy-Item -Path "C:\actions-runner\opengl32.dll" -Destination "testenv\Lib\site-packages\vtkmodules" -Force
#if: startsWith(github.event.ref, 'refs/heads/main') != true
- name: 'Create Documentations'
run: |
testenv\Scripts\Activate.ps1
sphinx-build -j auto -b html -a doc/source doc/_build/html
- name: ' Deploy on aedtdocs.pyansys.com'
id: deploy
continue-on-error: true
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
working-directory: doc/_build/html
run: |
git init
git checkout -b master
git config --local user.name "maxcapodi78"
git config --local user.email "massimo.capodiferro@ansys.com"
New-Item -ItemType file .nojekyll
New-Item -ItemType file CNAME
Add-Content CNAME "aedtdocs.pyansys.com"
git add .
git commit -m "Documentation generated by PyAedt Build"
git remote add origin https://${{ secrets.PYAEDT_DOCS }}@github.com/pyansys/PyAEDT-docs
git push -u origin master --force
# Retry the deployment in case some network issue prevented git to push
# the modifications properly. It happened in the past.
- name: Deploy Second try
if: steps.deploy.outcome != 'success' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
working-directory: doc/_build/html
run: |
git init
git checkout -b master
git config --local user.name "maxcapodi78"
git config --local user.email "massimo.capodiferro@ansys.com"
New-Item -ItemType file .nojekyll
New-Item -ItemType file CNAME
Add-Content CNAME "aedtdocs.pyansys.com"
git add .
git commit -m "Documentation generated by PyAedt Build"
git remote add origin https://${{ secrets.PYAEDT_DOCS }}@github.com/pyansys/PyAEDT-docs
git push -u origin master --force