[misc] update netlify ci #184
Workflow file for this run
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: Deploy Next.js site to Pages | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
pull-requests: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Restore cache | |
id: cache-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/home/runner/work/reactgeoda/csds_kepler | |
/home/runner/work/reactgeoda/geoda-lib | |
key: ${{ runner.os }}-csds_kepler-${{ hashFiles('deps.txt') }} | |
- name: Install dependencies | |
if: steps.cache-dependencies.outputs.cache-hit != 'true' | |
run: | | |
npm install -g npm | |
npm install -g yarn | |
npm install -g node-gyp | |
cd .. | |
pwd | |
git clone https://github.com/GeoDaCenter/kepler.gl.git --branch=xli/reactgeoda csds_kepler | |
cd csds_kepler | |
yarn | |
cd .. | |
git clone https://oauth2:${{ secrets.GEODA_LIB_TOKEN }}@github.com/GeoDaCenter/geoda-lib.git geoda-lib | |
- name: Run Lint | |
run: | | |
cd geoda-ai | |
yarn | |
yarn lint | |
- name: Build geoda-ai | |
id: build | |
run: | | |
touch .env | |
echo NEXT_PUBLIC_MAPBOX_TOKEN=${{ secrets.MAPBOX_TOKEN }} >> geoda-ai/.env | |
cd geoda-ai | |
yarn build-local | |
- name: Deploy to Netlify | |
id: deploy | |
uses: mathiasvr/[email protected] | |
with: | |
run: | | |
cd geoda-ai | |
netlify env:set NETLIFY_AUTH_TOKEN ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
netlify env:set NETLIFY_SITE_ID ${{ secrets.NETLIFY_SITE_ID }} | |
# if merge to main, deploy production to netlify | |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
netlify deploy --prod --dir=out --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
else | |
netlify deploy --dir=out --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
fi | |
# comment output of netlify deploy to PR | |
- name: Comment PR | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
:rocket: Deploy preview available at: ${{ steps.deploy.outputs.stdout }} | |
# - name: Build Library | |
# run: | | |
# cd library | |
# export NODE_OPTIONS=--openssl-legacy-provider | |
# yarn | |
# yarn build |