Add missing 2019 data [minor] #523
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
# Install packages, update data, test, and archive | |
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: "0 18 * * 2" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
if: contains(toJson(github.event.commits), '[skip ci]') == false | |
runs-on: ubuntu-latest | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 3 | |
- name: Setup R (Ubuntu) | |
uses: eddelbuettel/github-actions/r2u-setup@master | |
- name: Install packages | |
run: Rscript install-packages.R | |
- name: Update data | |
run: Rscript update-data.R | |
- name: Test | |
run: Rscript testthat.R | |
- name: Check for new files | |
id: check_files | |
run: | | |
if [[ -z "$(git status --porcelain)" ]] ; then | |
echo "Git status is empty" | |
echo "diff=FALSE" >> $GITHUB_OUTPUT | |
else | |
echo "diff=TRUE" >> $GITHUB_OUTPUT | |
fi | |
- name: Bump version | |
id: version | |
env: | |
LOG: ${{ github.event_name == 'pull_request' && '$(git log --no-merges --format=%B -n 1 HEAD^2)' || '$(git log --no-merges --format=%B -n 1 HEAD)' }} | |
CRON: ${{ github.event_name == 'schedule' && 'TRUE' || 'FALSE' }} | |
run: | | |
R -e "source('version_bump.R'); bump_version('${{ env.LOG }}', ${{ env.CRON }}, ${{ steps.check_files.outputs.diff }})" | |
if echo "$(git status --porcelain)" | grep -q version.txt ; then | |
echo "Version changed" | |
echo "new_ver=TRUE" >> $GITHUB_OUTPUT | |
else | |
echo "No version bump" | |
echo "new_ver=FALSE" >> $GITHUB_OUTPUT | |
fi | |
- name: Setup Tag | |
if: github.event_name != 'pull_request' && steps.version.outputs.new_ver == 'TRUE' | |
id: tagging | |
run: | | |
value=`cat version.txt` | |
echo "tag=$value" >> $GITHUB_OUTPUT | |
value="v${value}" | |
echo "release=$value" >> $GITHUB_OUTPUT | |
- name: Tag new version for release | |
if: github.event_name != 'pull_request' && steps.version.outputs.new_ver == 'TRUE' | |
env: | |
JOB_TAGS: ${{ github.event_name == 'schedule' && '[skip ci] [cron]' || '[skip ci]' }} | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: Weecology Deploy Bot | |
author_email: [email protected] | |
message: "Update data and trigger archive: GitHub Build ${{ github.run_number }} ${{ env.JOB_TAGS }}" | |
tag: ${{ steps.tagging.outputs.tag }} | |
- name: Create Release | |
if: github.event_name != 'pull_request' && steps.version.outputs.new_ver == 'TRUE' | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ steps.tagging.outputs.tag }} | |
name: ${{ steps.tagging.outputs.tag }} | |
body: ${{ steps.tagging.outputs.release }} |