archive_nflversedata #86
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
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=archive-$(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 ${{ needs.create_release.outputs.release_tag }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: ubuntu-22.04, r: 'release'} | |
tag: ${{ fromJson(needs.create_release.outputs.releases) }} | |
env: | |
GITHUB_PAT: ${{ secrets.NFLVERSE_GH_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
NFLVERSE_ARCHIVE_TAG: ${{ matrix.tag }} | |
NFLVERSE_ARCHIVE_TO: ${{ needs.create_release.outputs.release_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: | | |
local::. | |
ropensci/piggyback | |
nflverse/nflreadr | |
- name: Archive nflverse release ${{ matrix.tag }} | |
run: Rscript -e "source('dev/run_archive.R')" |