Deploy Next.js site to Pages and paris en selle #477
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 and paris en selle | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ['main'] | |
schedule: | |
- cron: '00 8 * * *' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
fetch_data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: fetch data | |
run: make data | |
- name: fetch metadata | |
run: make metadata | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: opendata | |
path: | | |
public/compteurs.csv | |
public/metadata.csv | |
fetch_multimodal_data: # we parallelize because it’s terribly slow | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: fetch data | |
run: make multimodal | |
- name: fetch metadata | |
run: make metadata | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: opendata_multimodal | |
path: | | |
public/comptage-multimodal-comptages.parquet | |
dataprep: | |
runs-on: ubuntu-latest | |
needs: [fetch_data, fetch_multimodal_data] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: get the opendata | |
uses: actions/download-artifact@v4 | |
with: | |
name: opendata | |
path: public | |
- name: get the opendata (multimodal) | |
uses: actions/download-artifact@v4 | |
with: | |
name: opendata_multimodal | |
path: public | |
- name: get duckdb | |
run: wget https://github.com/duckdb/duckdb/releases/download/v1.1.3/duckdb_cli-linux-amd64.zip && unzip duckdb_cli-linux-amd64.zip | |
- name: prepare data | |
run: ./duckdb compteurs.duckdb < prepare.sql | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: prepared | |
path: compteurs.duckdb | |
build: | |
runs-on: ubuntu-latest | |
needs: dataprep | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: get the opendata | |
uses: actions/download-artifact@v4 | |
with: | |
name: prepared | |
- name: Install dependencies | |
run: npm install | |
- name: Build with Next.js | |
env: | |
NEXT_PUBLIC_MAPBOX_TOKEN: ${{ secrets.NEXT_PUBLIC_MAPBOX_TOKEN }} | |
NEXT_PUBLIC_MAPBOX_CENTER: ${{ vars.NEXT_PUBLIC_MAPBOX_CENTER }} | |
NEXT_PUBLIC_MAPBOX_ZOOM: ${{ vars.NEXT_PUBLIC_MAPBOX_ZOOM }} | |
run: npm run build | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: website | |
path: out | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: get the built site | |
uses: actions/download-artifact@v4 | |
with: | |
name: website | |
path: public | |
- name: install lftp | |
run: sudo apt update && sudo apt install lftp --yes | |
- name: transfert by ftp | |
run: lftp -e "set ssl:verify-certificate no ; mirror -R --parallel=4 public /" -u "${{ secrets.CREDENTIALS }}" ftp-parisenselle.alwaysdata.net |