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

Update for version 7 #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
118 changes: 0 additions & 118 deletions .eslintrc

This file was deleted.

21 changes: 8 additions & 13 deletions .github/_workflow-samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,21 @@ This workflow gets triggered with every push to the main branch, and doesn't ver
- add the bucket name as an evironemnt variable (`DEPLOY_BUCKET`) to the deploy workflow. Omit `s3://` from the bucket name.

## Serving site from sub-path
This workflow assumes that the site is served from the root of the URL (eg. devseed.com). To support a URL served from a sub-path (eg. devseed.com/explorer), replace the `yarn build` step in the build job with the following steps:
This workflow assumes that the site is served from the root of the URL (eg. devseed.com). To support a URL served from a sub-path (eg. devseed.com/explorer), add the following step:

```
- name: Build
run: PUBLIC_URL="https://devseed.com/explorer" yarn build

- name: Serve site from subpath
run: |
cd dist
mkdir explorer
mv assets explorer/assets
cp index.html explorer
mkdir <subfolder>
mv assets <subfolder>/assets
cp index.html <subfolder>
```

# `deploy-surge-yml`
A workflow that builds the site and deploys it to Surge.
# `deploy-gh-yml`
A workflow that builds the site and deploys it to Github pages.

This workflow gets triggered with every push to the main branch, and doesn't verify if the checks were successful. It relies on branch protection to do so.

## First-time setup
- create a user on Surge
- add the secret token from Surge as [an encrypted secret to the project repository](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository). Use `SURGE_TOKEN`
- add `SURGE_DOMAIN` to the `deploy.yml`. This ensure the app is deployed to the same domain every time.
# S3 previews
Check the [Implementing S3 deploy previews](https://github.com/developmentseed/how/issues/423) guide to set up S3 previews for feature branches.
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@

# Deploy the site to Surge on a push to the 'main' branch

name: Deploy Surge
name: Deploy Github Pages

on:
push:
branches:
- 'main'

env:
NODE: 18
SURGE_DOMAIN:
PUBLIC_URL: ${{ vars.PUBLIC_URL }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE }}
node-version-file: '.nvmrc'

- name: Cache node_modules
uses: actions/cache@v3
Expand All @@ -45,34 +43,30 @@ jobs:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}

- name: Install
run: yarn install
run: npm install

- name: Build
run: yarn build
run: npm run all:build

deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Restore node_modules
uses: actions/cache@v3
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Restore dist cache
uses: actions/cache@v3
id: cache-dist
with:
path: dist
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}

- name: Deploy to Surge
run: |
cp ./dist/index.html ./dist/200.html
node_modules/surge/lib/cli.js ./dist ${{ env.SURGE_DOMAIN }} --token ${{ secrets.SURGE_TOKEN }}
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
clean: true
single-commit: true
folder: /dist
27 changes: 13 additions & 14 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@ on:
- ready_for_review

env:
NODE: 18
NODE: 20

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
prep:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE }}
uses: actions/setup-node@v3
Expand All @@ -47,15 +46,15 @@ jobs:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Install
run: yarn install
run: npm install

lint:
needs: prep
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE }}
uses: actions/setup-node@v3
Expand All @@ -70,18 +69,18 @@ jobs:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Install
run: yarn install
run: npm install

- name: Lint
run: yarn lint
run: npm run lint

test:
needs: prep
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE }}
uses: actions/setup-node@v3
Expand All @@ -96,7 +95,7 @@ jobs:
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Install
run: yarn install
run: npm install

- name: Test
run: yarn test
run: npm run test
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
3 changes: 2 additions & 1 deletion .parcelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": ["@parcel/config-default"],
"reporters": ["...", "@parcel/reporter-bundle-analyzer"]
"reporters": ["...", "@parcel/reporter-bundle-analyzer"],
"resolvers": ["parcel-resolver-ignore", "..."]
}
Loading
Loading