-
Notifications
You must be signed in to change notification settings - Fork 6
65 lines (56 loc) · 1.82 KB
/
update-portfolio-index.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
name: Update and deploy portfolio index site
on:
push:
branches: [main]
paths:
- '.github/workflows/update-portfolio-index.yml'
- 'portfolio/**'
pull_request:
paths:
- '.github/workflows/update-portfolio-index.yml'
- 'portfolio/**'
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install python packages
run: |
pip install -r portfolio/requirements.txt
- name: Netlify docs preview
if: ${{ github.ref != 'refs/heads/main' }}
run: |
npm install -g [email protected]
python portfolio/portfolio.py index --deploy --alias=${GITHUB_REPOSITORY#*/}-${PR_NUMBER}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
- name: Netlify docs production
if: ${{ github.ref == 'refs/heads/main' }}
run: |
npm install -g [email protected]
python portfolio/portfolio.py index --deploy --prod
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: Add netlify link PR comment
uses: actions/github-script@v7
if: ${{ github.event_name == 'pull_request' }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const suffix = "--cal-itp-data-analyses.netlify.app"
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Preview url: https://" + context.repo.repo + "-" + process.env.PR_NUMBER + suffix
})
env:
PR_NUMBER: ${{ github.event.number }}