forked from apache/airflow-site
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (139 loc) Β· 5.66 KB
/
build.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Build docs
on:
push:
branches: ['main']
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Based on https://github.com/actions/runner-images/issues/2840
- name: πͺ Remove some stuff we don't need
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: π Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
submodules: recursive
lfs: true
- name: π Setup Python
uses: actions/setup-python@41b7212b1668f5de9d65e9c82aa777e6bbedb3a8 # v2.1.4
with:
python-version: '3.7'
- name: β€οΈ Install Node 16
uses: actions/[email protected] # v3.3.0
with:
node-version: 16
- name: π Install Hugo
uses: peaceiris/[email protected] # v2.4.13
with:
hugo-version: '0.91.2'
extended: true
- name: π’ Install node dependencies
run: ./site.sh install-node-deps
- name: π Install Python dependencies
run: pip install -r requirements.txt
- name: π Lint
uses: apache/airflow-pre-commit-action@0764670bf370aab253130d534e1eda7ff497dc60 # v2.0.0
- name: π§ Build site
run: ./site.sh build-site
- name: π
Optimize artifacts
if: ${{ github.event_name == 'pull_request' }}
run: |
rm -rf ./dist/docs/*
echo "These files have been deleted to optimize the size of the artifacts." > ./dist/docs/index.html
echo "Here was the contents of the ./docs-archive directory" >> ./dist/docs/index.html
find ./dist/
- uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1
name: π Upload website as artifact
if: ${{ github.event_name == 'pull_request' }}
with:
name: airflow-website
path: './dist'
if-no-files-found: error
retention-days: 14
- name: π· Copy .asf.yaml to /dist/
if: ${{ github.event_name == 'push' }}
run: |
# The asf.yaml file must be in the branch from which the files are published.
# Otherwise, ASF publising tools cannot detect it.
cp .asf.yaml ./dist/
- name: πͺ Remove node modules
run: |
rm -rf node_modules
sudo rm -rf "$AGENT_TOOLSDIRECTORY/node"
- name: π Deploy website on asf-site branch
uses: apache/airflow-JamesIves-github-pages-deploy-action@132898c54c57c7cc6b80eb3a89968de8fc283505 # v3.7.1
if: ${{ github.event_name == 'push' }}
with:
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: dist # The folder the action should deploy.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CLEAN: true # Automatically remove deleted files from the deploy branch
- name: π§ Copy files from site to themeοΈ
run: ./site.sh prepare-theme
- name: π§ Prepare sphinx_airflow_theme package οΈ
working-directory: sphinx_airflow_theme
run: |
python3 -m pip install --user --upgrade setuptools wheel
python3 setup.py sdist bdist_wheel
- name: π Upload sphinx_airflow_theme package as artifact
uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1
with:
name: airflow-sphinx-theme
path: './sphinx_airflow_theme/dist'
if-no-files-found: error
retention-days: 14
- name: π§ Build theme demo
working-directory: sphinx_airflow_theme
run: |
pip install ./dist/sphinx_airflow_theme-*.whl
cd demo
./docs.sh build
- name: π Upload sphinx_airflow_theme demo as artifact
uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1
with:
name: airflow-sphinx-theme-demo
path: './sphinx_airflow_theme/demo/_build'
if-no-files-found: error
retention-days: 14
- name: π Create releases on GitHub
working-directory: sphinx_airflow_theme
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_COMMIT: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
if: >
github.ref == 'refs/heads/main' && github.repository == 'apache/airflow-site' &&
github.event_name == 'push'
run: |
set -x
gh auth status
VERSION="$(python setup.py --version 2>/dev/null | tail -1)"
TITLE=$(date "+%Y-%m-%d %H:%M:%S")
NOTES="Commit: ${GITHUB_COMMIT}
Source: ${GITHUB_REF}"
gh release delete "${VERSION}" -y || true
gh release create "${VERSION}" \
--title "${TITLE}" \
--notes "${NOTES}" \
./dist/*