Merge pull request #34 from ClimateCompatibleGrowth/new-calib #37
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 to GitHub Pages | |
on: | |
push: | |
branches: [main] | |
jobs: | |
data-pipeline: | |
runs-on: ubuntu-latest | |
env: | |
RENV_PATHS_ROOT: ~/.local/share/env | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 4.2.3 | |
- name: Cache packages | |
uses: actions/cache@v1 | |
with: | |
path: ${{ env.RENV_PATHS_ROOT }} | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-renv- | |
- name: Restore packages | |
shell: Rscript {0} | |
working-directory: data-processing/pipeline | |
run: | | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") | |
renv::restore() | |
- name: Run pipeline | |
env: | |
TEAM_IN_DIR: ${{ github.workspace }}/data-processing/data-input | |
TEAM_OUT_DIR: ${{ github.workspace }}/data-processing/data-output | |
working-directory: data-processing/pipeline | |
run: Rscript run.R | |
- name: Compress output files | |
run: tar czf data-output.tar.gz --directory=data-processing/data-output . | |
- name: Upload data artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: data | |
path: data-output.tar.gz | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- data-pipeline | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Download Data | |
uses: actions/download-artifact@v3 | |
with: | |
name: data | |
path: data-artifact | |
- name: Extract Data | |
run: tar xzf data-artifact/data-output.tar.gz --directory=dist/data | |
- name: Deploy | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: dist | |
clean: true |