-
-
Notifications
You must be signed in to change notification settings - Fork 16
102 lines (84 loc) · 3.19 KB
/
deploy.yaml
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
name: Deploy
'on':
push:
branches:
- main
repository_dispatch:
types:
- 'tutorials-build' # triggered from astropy/astropy-tutorials
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- name: Set up node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
- name: Cache dependencies
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.node_version.outputs.NODE_VERSION }}
- run: npm ci
name: Install
- run: npm run build
name: Build
- name: Upload gatsby artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: gatsby-build
path: ./public
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
- name: Install Python dependencies
run: |
python -m pip install -U pip
python -m pip install -r deployment/requirements.txt
- name: Download gatsby artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: gatsby-build
path: ./public
- name: Download tutorials for tutorial dispatch event
if: ${{ github.event == 'repository_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python deployment/installtutorials.py \
--dest public/tutorials \
--tutorials-run ${{ github.event.client_payload.runid }} \
--tutorials-artifact ${{ github.event.client_payload.artifactName }} \
--tutorials-repo ${{ github.event.client_payload.repo }}
- name: Download latest tutorials
if: ${{ github.event != 'repository_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python deployment/installtutorials.py --dest public/tutorials
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
- name: Index tutorials
env:
ALGOLIA_ID: ${{ secrets.ALGOLIA_ID }}
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}
ALGOLIA_INDEX: ${{ secrets.ALGOLIA_INDEX }}
run: |
astropylibrarian index tutorial-site \
public/tutorials \
https://learn.astropy.org/tutorials