Deploy Docker Image #88
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
--- | |
name: Deploy Docker Image | |
on: | |
workflow_dispatch: # give possibility to run it manually | |
schedule: | |
- cron: '0 0 * * Wed,Sun' # Run every day at midnight UTC | |
permissions: write-all | |
env: | |
REGISTRY: ghcr.io | |
R_REPOS: "https://cran.r-project.org" | |
concurrency: | |
group: deploy-docker-image-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
deploy-image: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # if one of the job "deploy-image" fails, the other parallel jobs will just continue | |
matrix: | |
tags: ["devel", "latest"] | |
# Token permissions | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Print message | |
run: | | |
echo "updating docker image for R version ${{ matrix.tags }}" | |
- name: Set image specs | |
id: image_specs | |
run: | | |
package_name=$(grep "Package:" DESCRIPTION | awk '{print $NF}') | |
echo "image_name=$package_name-${{ matrix.tags }}" >> $GITHUB_OUTPUT | |
echo "r_repos=$R_REPOS" >> $GITHUB_OUTPUT | |
- name: Call deploy docker image action ${{ matrix.tags }} | |
uses: insightsengineering/r-image-creator@rework_r_repos | |
with: | |
image-name: "${{ steps.image_specs.outputs.image_name }}" | |
tag-latest: true | |
base-image: "rocker/rstudio:${{ matrix.tags }}" | |
sysdeps: qpdf,libxt-dev,curl,npm,libicu-dev,libcurl4-openssl-dev,libssl-dev,make,zlib1g-dev,libfontconfig1-dev,libfreetype6-dev,libfribidi-dev,libharfbuzz-dev,libjpeg-dev,libpng-dev,libtiff-dev,pandoc,libxml2-dev,libgit2-dev,libgit2-dev,jq | |
description-file: "https://raw.githubusercontent.com/pharmaverse/admiral/main/DESCRIPTION" | |
repository-owner: ${{ github.repository_owner }} | |
repo-user: ${{ github.actor }} | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
repos: ${{ steps.image_specs.outputs.r_repos }} | |
packages: "DT,R.cache,R.methodsS3,R.oo,R.utils,backports,cellranger,collections,covr,crosstalk,cyclocomp,diffdf,git2r,hunspell,languageserver,lazyeval,lintr,progress,readxl,rematch,renv,rex,spelling,staged.dependencies,styler,xmlparsedata" | |
store_deps: | |
name: Store Deps | |
runs-on: ubuntu-latest | |
needs: ["deploy-image"] | |
container: | |
image: "ghcr.io/pharmaverse/admiralci-${{ matrix.tags }}:latest" | |
strategy: | |
fail-fast: false # if one of the job "deploy-image" fails, the other parallel jobs will just continue | |
matrix: | |
tags: ["devel", "latest"] | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
##################### BEGIN boilerplate steps ##################### | |
- name: Store deps into csv file - image ${{ matrix.tags }} | |
run: | | |
installed_packages <- as.data.frame(installed.packages()) | |
write.csv(installed_packages, "/workspace/deps.csv", row.names = FALSE) | |
shell: Rscript {0} | |
- name: Upload deps.csv artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: deps | |
path: "/workspace/deps-${{ matrix.tags }}.csv" | |
# refacto todo: image-name, sysdeps on get-renv-list job | |
# note: in case of 403 error when pushing to ghcr : link current repo to the given package registry - https://github.com/docker/build-push-action/issues/687 | |
# (got to https://github.com/<user name>?tab=packages to go to packages settings) and there https://github.com/users/<user name>/packages/container/admiralci-4.0/settings |