Skip to content

Build rig containers for new release #232

Build rig containers for new release

Build rig containers for new release #232

Workflow file for this run

name: Build rig containers overnight
on:
workflow_dispatch:
schedule:
- cron: '55 8 * * *'
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.setup-matrix.outputs.containers }}
steps:
- uses: actions/checkout@v3
- name: Set up matrix of containers
id: setup-matrix
run: |
(echo -n 'containers=['; ls containers | sed 's|/$||' |
awk '{ printf("\"%s\",", $1) }' | sed 's/,$//'; echo -n ']') >> $GITHUB_OUTPUT
containers:
needs: setup-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: ${{ fromJson(needs.setup-matrix.outputs.containers) }}
name: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
context: containers/${{ matrix.container }}
load: true
tags: |
rhub/rig:test
- name: Test
run: |
docker run rhub/rig:test rig ls
- name: Push
uses: docker/build-push-action@v3
with:
platforms: linux/amd64, linux/arm64
context: containers/${{ matrix.container }}
push: true
outputs:
tags: |
rhub/rig:latest
ghcr.io/r-lib/rig/${{ matrix.container }}:latest