forked from E3SM-Project/E3SM
-
Notifications
You must be signed in to change notification settings - Fork 6
76 lines (69 loc) · 2.41 KB
/
omega-docs-workflow.yml
File metadata and controls
76 lines (69 loc) · 2.41 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
name: omega-release
on:
push:
branches: [develop]
# But only if Omega docs-related files are touched
paths:
- components/omega/doc/**
env:
PYTHON_VERSION: "3.13"
jobs:
publish-docs:
if: ${{ github.repository == 'E3SM-Project/E3SM' }} or \
${{ github.repository == 'E3SM-Project/Omega' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Conda Environment
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: "omega_ci"
miniforge-version: latest
channels: conda-forge
channel-priority: strict
auto-update-conda: true
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
conda create -n omega_dev --file components/omega/dev-conda.txt \
python=${{ env.PYTHON_VERSION }}
conda activate omega_dev
conda list
- name: Build Omega Docs with Sphinx
# Use 'make html' (not html-strict) so docs always update, even if warnings exist.
run: |
conda activate omega_dev
cd components/omega/doc
make html
- name: Copy Docs and Commit
run: |
conda activate omega_dev
cd components/omega/doc
# gh-pages branch must already exist
git clone https://github.com/${{ github.repository }}.git --branch gh-pages --single-branch gh-pages
# Make sure we're in the gh-pages directory.
cd gh-pages
# Replace `Omega` docs with latest changes
rm -rf Omega
mkdir Omega
cp -r ../_build/html/* Omega/
# Configure git using GitHub Actions credentials.
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# The second command will fail if no changes were present, so we ignore it
git add .
git commit -m "Update documentation" -a || true
- name: Push Changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: components/omega/doc/gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true