refresh-osd #273
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: refresh-osd | |
# just for testing | |
#on: push | |
# weekly refresh Midnight (0:00 UTC) on Mondays | |
on: | |
schedule: | |
- cron: '0 0 * * 1' | |
push: | |
paths: | |
- 'refresh-osd.yml' | |
workflow_dispatch: | |
# see: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions | |
# and: https://github.com/r-lib/actions | |
jobs: | |
refresh: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
# try fixing a specific firefox version 109.0 for now | |
- run: | | |
sudo apt-get update | |
sudo apt install -y libcurl4-openssl-dev | |
wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/109.0/linux-x86_64/en-US/firefox-109.0.tar.bz2 | |
tar -xjf firefox-*.tar.bz2 | |
sudo mv firefox /opt | |
sudo ln -s /opt/firefox/firefox /usr/local/bin/firefox | |
- uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
- run: R CMD build --no-manual ../OSDRegistry | |
- run: Rscript -e 'system2("R", paste0(sprintf("CMD INSTALL OSDRegistry_%s.tar.gz", read.dcf("DESCRIPTION")[,"Version"])))' | |
- run: Rscript -e 'OSDRegistry::refresh_registry()' | |
- run: Rscript -e 'system(sprintf("zip OSD_%s.zip OSD/*/*", Sys.Date()))' | |
- run: Rscript -e 'system(sprintf("zip SC_%s.zip SC/*", Sys.Date()))' | |
- run: zip OSD-data-snapshot.zip OSD_*.zip | |
- run: zip SC-data-snapshot.zip SC_*.zip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: OSD-data-snapshot | |
path: "OSD-data-snapshot.zip" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: SC-data-snapshot | |
path: "SC-data-snapshot.zip" | |
- run: git config user.email github-actions@github.com | |
- run: git config user.name SeriesCuratorBot | |
- run: git add OSD/*/*.txt | |
- run: Rscript -e 'system(sprintf("git commit -am \"OSD Data Refresh - %s\"", Sys.Date()))' | |
- run: git add SC/* | |
- run: Rscript -e 'system(sprintf("git commit -am \"SC Data Refresh - %s\"", Sys.Date()))' | |
- run: git push | |
- name: Upload snapshot to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "*-data-snapshot.zip" | |
tag: ${{ github.ref }} | |
file_glob: true | |
overwrite: true | |
body: "Download the complete Official Series Description and Series Classification Database weekly snapshot as ZIP files." | |
env: | |
DEFAULT_BRANCH: main | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |