-
Notifications
You must be signed in to change notification settings - Fork 339
119 lines (114 loc) · 4.71 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
# 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: ['master']
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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.6'
- name: 🐳 Build Docker image
run: ./site.sh build-image
- name: 🟢 Install node depedencies
run: ./site.sh install-node-deps
- name: 🐍 Install Python depedencies
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: 🚀 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: asf-site # 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/master' && github.repository == 'apache/airflow-site' &&
github.event_name == 'push'
run: |
gh auth status
VERSION="$(python setup.py --version)"
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/*