-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (109 loc) · 3.51 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
name: Build packages on build branch
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
# =====================================================
# Build
# =====================================================
- name: Build JS and CSS resources
run: |
cd js
npm install
npm run build
npm run build-styles
- name: Build Python package
run: |
cd py
pip install -e .[dev]
make dist
# Even though pip can install from a git repository, we build a Python
# wheel here so that it can be easily installed from Pyodide. In Pyodide,
# pip is not available; it has micropip, which can't install from a git
# repository, but can install a wheel.
# =====================================================
# Commit to main-build branch
# =====================================================
# Name and email are needed to push.
- name: Configure git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Commit built files and push to main-build branch
if: github.ref == 'refs/heads/main'
shell: bash
run: |
export SHA_SHORT=$(git rev-parse --short HEAD)
git checkout -B main-build
git add -f js/out/
git add -f py/dist/*.whl
git commit -m"Build js/css for $SHA_SHORT"
git log -n 4 --pretty=oneline --simplify-by-decoration
git push -f origin main-build:main-build
# =====================================================
# Build and deploy site
# =====================================================
deploy-site:
if: github.ref == 'refs/heads/main'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install R
uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
packages:
any::knitr
any::rmarkdown
any::tibble
any::htmltools
# any::reticulate
- uses: quarto-dev/quarto-actions/setup@v2
- name: Build design doc
run: |
cd js/src/styles
quarto render *.qmd
- name: Build storybook
run: |
cd js/
npm ci
npm run build-storybook
- name: Move build artifacts to site dir
run: |
mkdir -p site
cp -R js/src/styles site/style-guide
cp -R js/storybook-static site/storybook
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "./site"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2