Check for new R versions #7911
This file contains hidden or 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: Check for new R versions | |
| on: | |
| schedule: | |
| - cron: "0 * * * *" | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: | | |
| Publish the builds to S3 staging or production? Defaults to staging. | |
| required: false | |
| default: 'staging' | |
| type: choice | |
| options: | |
| - staging | |
| - production | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| check-r-versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_r_versions: ${{ steps.check_r_versions.outputs.new_r_versions }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_PUBLISH_ROLE }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Check for new R versions to build | |
| id: check_r_versions | |
| run: | | |
| publish=${{ inputs.publish || 'production' }} | |
| if [ $publish == 'staging' ]; then | |
| s3_bucket=${{ secrets.S3_BUCKET_STAGING }} | |
| else | |
| s3_bucket=${{ secrets.S3_BUCKET_PRODUCTION }} | |
| fi | |
| new_r_versions=$(python manage_r_versions.py check --s3-bucket="${s3_bucket}") | |
| if [ -z "$new_r_versions" ]; then | |
| echo "No new R versions found" | |
| else | |
| echo "New R versions: $new_r_versions" | |
| fi | |
| echo "new_r_versions=$new_r_versions" >> $GITHUB_OUTPUT | |
| build-new-r-versions: | |
| needs: check-r-versions | |
| if: ${{ needs.check-r-versions.outputs.new_r_versions != '' }} | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| r_versions: ${{ needs.check-r-versions.outputs.new_r_versions }} | |
| publish: ${{ inputs.publish || 'production' }} | |
| secrets: inherit | |
| # Notify Hosted about new R versions | |
| notify-slack-success: | |
| needs: [build-new-r-versions, check-r-versions] | |
| if: ${{ needs.check-r-versions.outputs.new_r_versions != '' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Notify Slack on successful new R version build | |
| uses: slackapi/slack-github-action@v2.1.0 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| text: "R-builds - new R versions built and published: ${{ needs.check-r-versions.outputs.new_r_versions }}" |