Build & Deploy docs GitHub Action: auto delete canceled (#5249) #14650
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build/deploy docs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-deploy-docs: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
if: github.repository_owner == 'skyportal' | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_USER: skyportal | |
POSTGRES_PASSWORD: anything | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a | |
# healthcheck | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: "MercuryTechnologies/delete-cancelled-runs@f5c9d322d9c7afbd41f779199818c1ffe381d34b" #v1.0.0 | |
with: | |
workflow-file: "build-and-deploy-docs.yaml" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.npm | |
key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm-${{ hashFiles('package.json') }} | |
${{ runner.os }}-npm- | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} | |
${{ runner.os }}-pip- | |
# caching dustmap & sncosmo files is dependent on their corresponding | |
# python package versions, so we use that as the cache key | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
persistentdata/dustmap/sfd | |
key: ${{ runner.os }}-dustmap-${{ hashFiles('**/requirements*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-dustmap-${{ hashFiles('**/requirements*.txt') }} | |
${{ runner.os }}-dustmap- | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.astropy/cache/sncosmo/bandpasses | |
key: ${{ runner.os }}-sncosmo-${{ hashFiles('**/requirements*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-sncosmo-${{ hashFiles('**/requirements*.txt') }} | |
${{ runner.os }}-sncosmo- | |
- name: Setup Graphviz | |
uses: ts-graphviz/setup-graphviz@v1 | |
- name: Write SkyPortal config | |
run: | | |
cat << EOF > config.yaml | |
database: | |
database: skyportal | |
host: localhost | |
port: 5432 | |
user: skyportal | |
password: anything | |
EOF | |
- name: Install system dependencies | |
run: | | |
sudo apt update -y | |
sudo apt install -y libcurl4-gnutls-dev libgnutls28-dev | |
python -m pip install pip==24.0 | |
pip install numpy wheel | |
pip install -r baselayer/requirements.txt | |
pip install -r requirements.txt | |
export NPM_PACKAGES="${HOME}/.npm-packages" | |
export PATH=${NPM_PACKAGES}/bin:$PATH | |
export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH" | |
sudo npm -g install npm@latest | |
- name: Checkout branch being tested | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
clean: false | |
- name: Build docs | |
run: | | |
make docs | |
touch doc/_build/html/.nojekyll | |
- name: Install SSH Client 🔑 | |
if: github.ref == 'refs/heads/main' | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.CI_DEPLOY_KEY }} | |
- name: Deploy docs | |
if: github.ref == 'refs/heads/main' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
FOLDER: doc/_build/html | |
REPOSITORY_NAME: skyportal/docs | |
BRANCH: gh-pages | |
SSH: true |