Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Mapbox geocoder + GitHub Actions Automation #3

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GOOGLE_API_KEY=[token]
NODE_ENV_MAPBOX_ACCESS_TOKEN=[token]
65 changes: 65 additions & 0 deletions .github/workflows/scrape-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Scrape + Deploy to Netlify

on:
schedule:
# https://crontab.guru/#0_1_*_*_*
- cron: "0 1 * * *"
push:
branches: [main, gh-actions]
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key:
${{ runner.os }}-build-${{ env.cache-name }}-${{
hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == false }}
name: List the state of node modules
continue-on-error: true
run: npm list
- name: Install dependencies
run: npm ci
- name: Scrape data
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
NODE_ENV_MAPBOX_ACCESS_TOKEN:
${{ secrets.NODE_ENV_MAPBOX_ACCESS_TOKEN }}
run: npm run scrape
- name: Build app with Parcel
env:
NODE_ENV_MAPBOX_ACCESS_TOKEN:
${{ secrets.NODE_ENV_MAPBOX_ACCESS_TOKEN }}
run: npm run build --if-present
- name: "Deploy to Netlify"
uses: nwtgck/actions-netlify@v1.2
with:
publish-dir: "./dist"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist
static/data/**
231 changes: 229 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,233 @@
.env
.parcel-cache
.DS_Store
testinglines*

static/data/

# From parcel-bundlder
node_modules/
/target/
.DS_Store
package-lock.json
coverage/
.nyc_output/
.cache/
.parcel-cache/
dist/
node_modules/
lib/
.vscode/
.idea/
*.min.js

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
tmp
parcel-bundle-reports/
.verdaccio_storage/
sourcemap-info.json

# Created by https://www.toptal.com/developers/gitignore/api/node,macos,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos,visualstudiocode

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# Support for Project snippet scope
.vscode/*.code-snippets

# Ignore code-workspaces
*.code-workspace

# End of https://www.toptal.com/developers/gitignore/api/node,macos,visualstudiocode
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.14.2
13 changes: 13 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": [
"@parcel/config-default"
],
"resolvers": [
"...",
"parcel-resolver-ignore"
],
"reporters": [
"...",
"parcel-reporter-static-files-copy"
]
}
5 changes: 2 additions & 3 deletions .postcssrc
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
"plugins": {
"postcss-import": true,
"tailwindcss": true,
"postcss-nested": true,
"autoprefixer": true
"postcss-nested": true
}
}
}
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/scripts/testingsites_collect.js"
}
]
}
Loading