Skip to content

Commit

Permalink
Switch deployment to GitHub pages (#22)
Browse files Browse the repository at this point in the history
* fix: Cleanup

Cleanup HTML, CSS, JavaScript

* feat: Add minimal GH Actions setup

* fix: Build script

* fix: Debug build script

* fix: Further debug

* fix: Change root dir

Co-authored-by: David Adler <[email protected]>
  • Loading branch information
nathanlesage and trutzig89182 authored Nov 4, 2022
1 parent 05aa4eb commit 655f051
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This workflow builds and uploads the page to the GitHub page associated with
# this repository
name: Build and deploy to Github pages
# ADAPTED FROM https://github.com/actions/starter-workflows/blob/main/pages/static.yml

on:
# Runs on pushes targeting the default branch (in our case: main)
push:
branches: [$default-branch]
# This toggle enables us to run the workflow manually
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Only one build at a time (cancel running ones if necessary)
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
# Checkout the repo
- name: Checkout
uses: actions/checkout@v3


# --- --- --- FROM HERE ON BUILDING
- name: Setup NodeJS 16
uses: actions/setup-node@v1
with:
node-version: '16'
- name: Run build script
# NOTE: We have to switch this out for the real build script once we have it
run: |
./scripts/build.sh
# From here on only upload and deploy
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload the "dist" directory
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
#Mac system files
# Mac system files
.DS_Store

# Build directory
dist
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "mastodon-lists",
"version": "1.0.0",
"description": "A template to build hand-curated lists of accounts to follow",
"main": "index.js",
"repository": "https://github.com/trutzig89182/Mastodon-Sociologists.git",
"author": "Hendrik Erz <[email protected]>",
"license": "GPL-3.0",
"scripts": {
"build": "node scripts/build.js"
}
}
2 changes: 2 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// DEBUG: DUMMY SCRIPT! We need this (respectively webpack) once we switch to
// a dynamic page build.
11 changes: 11 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
echo "Running in directory $(pwd)"
echo "$(ls)"
mkdir dist
cp index.html ./dist
cp tootformat.html ./dist
cp instructions.html ./dist
cp instructions.pdf ./dist

# Copy the dirs
cp -R ./resources ./dist/
cp -R ./assets ./dist/

0 comments on commit 655f051

Please sign in to comment.