Skip to content

portalcasting v0.60.5 #907

portalcasting v0.60.5

portalcasting v0.60.5 #907

Workflow file for this run

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
name: Docker
jobs:
build-docker-image:
strategy:
fail-fast: false
matrix:
include:
- dockerfile: docker/Dockerfile
image: weecology/portalcasting
image_name: base
tag_prefix: ''
- dockerfile: docker/Dockerfile
image: weecology/portalcasting
image_name: sandbox
tag_prefix: sandbox_
- dockerfile: docker/Dockerfile
image: weecology/portalcasting
image_name: production
tag_prefix: production_
runs-on: ubuntu-latest
name: ${{ matrix.image_name }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ matrix.image }}
tags: |
type=raw,value=${{ matrix.tag_prefix }}latest
type=semver,pattern={{raw}},prefix=${{ matrix.tag_prefix }}
- name: Build ${{ matrix.image_name }} image
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ${{ matrix.dockerfile }}
build-args: |
"event_sha=${{ github.sha }}"
"image_name=${{ matrix.image_name }}"
- name: Test ${{ matrix.image_name }} image
run: |
docker run weecology/portalcasting:${{ matrix.tag_prefix }}latest r -e "library(portalcasting)"
- name: Push ${{ matrix.image_name }} image
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ${{ matrix.dockerfile }}
build-args: |
"event_sha=${{ github.sha }}"
"image_name=${{ matrix.image_name }}"
- name: Update dockerhub descriptions upon release
if: ${{ github.event_name == 'release' }}
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: weecology/portalcasting
readme-filepath: ./docker/README.md
short-description: ${{ github.event.repository.description }}