Skip to content

archive_nflversedata #83

archive_nflversedata

archive_nflversedata #83

Workflow file for this run

on:
schedule:
# At 15:15 on Thursdays every week in Sep - Jan
- cron: '15 15 * 9-12,1 4'
# At 15:15 on the 15th day of each month from Feb -> Aug
- cron: '15 15 15 2-8 *'
workflow_dispatch:
name: archive_nflversedata
jobs:
create_release:
runs-on: ubuntu-latest
name: create_release
env:
GH_TOKEN: ${{ secrets.NFLVERSE_GH_TOKEN }}
outputs:
releases: ${{ steps.query_releases.outputs.releases }}
release_tag: ${{ steps.create_tag.outputs.release_tag }}
steps:
- name: Create release with gh
id: create_tag
run: |
release_tag=$(date '+%Y-%m-%d')
gh release create $release_tag -t $release_tag -R nflverse/nflverse-data-archives || true
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
- id: query_releases
run: echo "releases=$(gh release list -R nflverse/nflverse-data --exclude-drafts --json tagName --jq '[.[].tagName]')" > $GITHUB_OUTPUT
archive_nflversedata:
needs: create_release
runs-on: ${{ matrix.config.os }}
name: Archive ${{ matrix.tag }} under ${{ matrix.archive_tag }}
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-22.04, r: 'release'}
tag: ${{ fromJson(needs.create_release.outputs.releases) }}
archive_tag: ${{ needs.create_release.outputs.release_tag }}
env:
GITHUB_PAT: ${{ secrets.NFLVERSE_GH_TOKEN }}
R_KEEP_PKG_SOURCE: yes
NFLVERSE_ARCHIVE_TAG: ${{ matrix.tag }}
NFLVERSE_ARCHIVE_TO: ${{ matrix.archive_tag }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 1
extra-packages: |
ropensci/piggyback
nflverse/nflreadr
- name: Archive nflverse release ${{ matrix.tag }}
run: Rscript -e "source('dev/run_archive.R')"