Skip to content

Add GH action to build an artifact for map.nycmesh.net #6

Add GH action to build an artifact for map.nycmesh.net

Add GH action to build an artifact for map.nycmesh.net #6

Workflow file for this run

name: Build distribution artifact for map.nycmesh.net
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Run every 10 minutes to fetch new map updates from the database and create an artifact with the new data
schedule:
- cron: "*/10 * * * *"
pull_request:
# Default to bash
defaults:
run:
shell: bash
env:
NODE_OPTIONS: '--openssl-legacy-provider'
jobs:
# Build job
build:
runs-on: ubuntu-22.04
env:
HUGO_VERSION: 0.69.2
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Update map
run: sh update-map.sh
- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
hugo \
--minify \
--baseURL "https://map.nycmesh.net/"
- name: Build Map Payload
run: mkdir -p public/map/map/ && mv public/map/static/ public/map/map/static/
- name: Publish map site build for map.nycmesh.net to fetch and host
uses: actions/upload-artifact@v4
with:
name: map-site-build
path: public/map/
retention-days: 7