--- /dev/null
+# Build the project and deploy it to GitHub pages
+name: Deploy
+
+on: # yamllint disable-line rule:truthy
+ push:
+ branches: [master, main, production]
+
+jobs:
+ deploy:
+ name: Build and Deploy API
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout source repository
+ uses: actions/checkout@v2
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+ - name: Install dependencies
+ shell: bash
+ run: ./ci/install.sh
+ - name: Build API content
+ shell: bash
+ run: ./ci/build.sh
+ - name: Deploy to GitHub Pages
+ uses: JamesIves/github-pages-deploy-action@v4
+ with:
+ BRANCH: gh-pages # The branch the action should deploy to
+ FOLDER: ./fsf-api-build-output # The folder the action should deploy
+ CLEAN: true # Automatically remove deleted files from the deploy branch
--- /dev/null
+# Build the project and test that it works correctly
+# Based on https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: Test
+
+on: # yamllint disable-line rule:truthy
+ push:
+ branches: ['staging*']
+ pull_request:
+ branches: [master, main, '*.*', 'staging*', 'production']
+
+jobs:
+ build:
+ name: Build API
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout source repository
+ uses: actions/checkout@v2
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+ - name: Install dependencies
+ shell: bash
+ run: ./ci/install.sh
+ - name: Build API content
+ shell: bash
+ run: ./ci/build.sh
+ - name: Check output directory is not empty
+ run: python -bb -X dev -W error ./ci/check_dir_empty.py fsf-api-build-output
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>Redirecting to https://github.com/spdx/fsf-api</title>
+ <meta http-equiv="refresh" content="0; URL=https://github.com/spdx/fsf-api">
+ <link rel="canonical" href="https://github.com/spdx/fsf-api">
+ </head>
+ <body>
+ This API is documented at <a href="https://github.com/spdx/fsf-api">https://github.com/spdx/fsf-api</a>.
+ </body>
+</html>
--- /dev/null
+#!/bin/bash -ex
+
+python3 -bb -X dev -W error pull.py fsf-api-build-output
+cp -a assets/. fsf-api-build-output/
--- /dev/null
+#!/usr/bin/env python3
+#
+# SPDX-License-Identifier: MIT
+
+"""Trivial script to check if a passed directory exists and is not empty."""
+
+import sys
+from pathlib import Path
+
+DIR_PATH = Path(sys.argv[1])
+if not DIR_PATH.exists():
+ sys.exit(f"Output directory {DIR_PATH.as_posix()!r} does not exist")
+dir_empty = not any(DIR_PATH.iterdir())
+if dir_empty:
+ sys.exit(f"Output directory {DIR_PATH.as_posix()!r} was empty")
--- /dev/null
+#!/bin/bash -ex
+
+python3 -m pip install --upgrade pip setuptools wheel
+python3 -m pip install --upgrade -r requirements.txt