Generate and upload data report #179
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: Generate and upload data report | |
on: | |
schedule: | |
- cron: '0 0 * * 1,4' | |
env: | |
GCP_SA_KEY: ${{ secrets.PESKAS_DATAINGESTION_GCS_KEY }} | |
AIRTABLE_KEY: ${{ secrets.AIRTABLE_KEY }} | |
jobs: | |
build-container: | |
name: Build R container | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Build image with cache | |
id: build-docker | |
uses: whoan/docker-build-with-cache-action@v5 | |
with: | |
username: $GITHUB_ACTOR | |
password: "${{ secrets.GITHUB_TOKEN }}" | |
registry: docker.pkg.github.com | |
image_name: r-runner-peskas-timor | |
dockerfile: Dockerfile.prod | |
data-report: | |
name: Generate data report | |
needs: [build-container] | |
runs-on: ubuntu-20.04 | |
container: | |
image: docker.pkg.github.com/worldfishcenter/peskas.timor.data.pipeline/r-runner-peskas-timor | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Set env to production | |
if: endsWith(github.ref, '/main') | |
run: echo "R_CONFIG_ACTIVE=production" >> $GITHUB_ENV | |
- name: Generate and upload data report | |
run: Rscript -e 'source(system.file("report/generate_upload_report.R", package = "peskas.timor.data.pipeline"))' |