From 400aa574346fcd43d119334490c7188d5b532a60 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 17 Jun 2024 16:42:17 +0100 Subject: [PATCH] Set up preview deployment. --- .github/workflows/publish.yml | 49 +++++++++++++++++++++++++++++++++ Makefile | 8 +++++- pinout.css => assets/pinout.css | 0 pinout.js => assets/pinout.js | 0 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml rename pinout.css => assets/pinout.css (100%) rename pinout.js => assets/pinout.js (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..718a7bc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,49 @@ +name: Publish + +on: + push: + branches: + - website + +permissions: + contents: read + pages: write + id-token: write + +jobs: + deploy: + name: Deploy Website Preview + runs-on: ubuntu-latest + + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install Dependencies + run: | + make dev-deps + + - name: Build Website Preview + run: | + make build + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload Artifact + uses: actions/upload-pages-artifact@v2 + with: + path: 'build' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/Makefile b/Makefile index bd908b2..1d75bfc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: usage check pytest qa build-deps check +.PHONY: usage check pytest qa build-deps check build usage: @echo "Usage: make , where target is one of:\n" @echo "dev-deps: install Python dev dependencies" @@ -22,3 +22,9 @@ qa: pytest: tox -e py + +build: + mkdir -p build + python build.py > build/index.html + cp assets/pinout.css build/ + cp assets/pinout.js build/ \ No newline at end of file diff --git a/pinout.css b/assets/pinout.css similarity index 100% rename from pinout.css rename to assets/pinout.css diff --git a/pinout.js b/assets/pinout.js similarity index 100% rename from pinout.js rename to assets/pinout.js