Skip to content

Merge pull request #3270 from infotroph/downscale-daily-timesteps #1981

Merge pull request #3270 from infotroph/downscale-daily-timesteps

Merge pull request #3270 from infotroph/downscale-daily-timesteps #1981

Workflow file for this run

name: Docker Depends Image
on:
push:
branches:
- develop
- master
workflow_dispatch:
# this runs on the develop branch
schedule:
- cron: '0 0 * * *' # midnight daily
- cron: '30 1 * * 1' # 1:30 AM every Monday (devel only)
env:
# official supported version of R
SUPPORTED: 4.1
DOCKERHUB_ORG: pecan
jobs:
depends:
if: github.repository == 'PecanProject/pecan'
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
R:
- "4.1"
- "4.2"
- "4.3"
- "devel"
steps:
- name: Work around https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
set-safe-directory: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
buildkitd-flags: --debug
install: true
# calculate some variables that are used later
- name: github branch
# build Rdevel only on Mondays, others every day (but not twice on Mondays)
if: |
github.event_name == 'workflow_dispatch' ||
(matrix.R != 'devel' && github.event.schedule == '0 0 * * *') ||
(matrix.R == 'devel' && github.event.schedule == '30 1 * * 1')
run: |
BRANCH=${GITHUB_REF##*/}
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
tags="R${{ matrix.R }}"
if [ "${{ matrix.R }}" == "${{ env.SUPPORTED }}" ]; then
if [ "$BRANCH" == "master" ]; then
tags="${tags},latest"
elif [ "$BRANCH" == "develop" ]; then
tags="${tags},develop"
fi
fi
echo "TAG=${tags}" >> $GITHUB_ENV
# this will publish to the actor (person) github packages
- name: Publish to GitHub
if: env.TAG != ''
uses: elgohr/Publish-Docker-Github-Action@v5
env:
R_VERSION: ${{ matrix.R }}
with:
name: ${{ github.repository_owner }}/pecan/depends
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
context: docker/depends
tags: "${{ env.TAG }}"
registry: docker.pkg.github.com
buildargs: R_VERSION
# this will publish to the clowder dockerhub repo
- name: Publish to Docker Hub
if: env.TAG != ''
uses: elgohr/Publish-Docker-Github-Action@v5
env:
R_VERSION: ${{ matrix.R }}
with:
name: ${{ env.DOCKERHUB_ORG }}/depends
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
context: docker/depends
tags: "${{ env.TAG }}"
buildargs: R_VERSION