Skip to content

remove rt from redirects so we can deploy it manually #327

remove rt from redirects so we can deploy it manually

remove rt from redirects so we can deploy it manually #327

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.8
- 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 netlify-cli
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 netlify-cli
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@v3
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 }}