Build distribution artifact for map.nycmesh.net #1584
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 distribution artifact for map.nycmesh.net | |
on: | |
# 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: "3,13,23,33,43,53 * * * *" | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
env: | |
NODE_OPTIONS: '--openssl-legacy-provider' | |
jobs: | |
# Build job | |
build: | |
if: github.repository == 'nycmeshnet/nycmesh.net' | |
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 | |
env: | |
STANDALONE_MAP_BUILD: true | |
run: sh update-map.sh | |
- name: Build with Hugo | |
env: | |
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache | |
HUGO_ENVIRONMENT: production | |
run: | | |
hugo \ | |
--minify \ | |
--baseURL "https://nycmesh.net/" | |
- name: Build Map Payload | |
run: | | |
mkdir -p public/map/img/ | |
mv public/img/map/ public/map/img/map/ | |
mv public/favicon.ico public/map/favicon.ico | |
mv public/404.html public/map/ | |
- 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 |