Merge pull request #29 from virtualstaticvoid/feat/build-multiple-r-v… #14
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: Build & Publish | |
on: | |
push: | |
tags: [ '*.*.*' ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
LATEST_VERSION: 4.4.2 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
strategy: | |
matrix: | |
r_version: | |
- 4.2.3 | |
- 4.3.3 | |
- 4.4.2 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build | |
run: make --no-builtin-rules build R_VERSION=${{ matrix.r_version }} | |
- name: Unit Tests | |
run: make --no-builtin-rules test R_VERSION=${{ matrix.r_version }} | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish images | |
if: github.event_name != 'pull_request' | |
run: make --no-builtin-rules push R_VERSION=${{ matrix.r_version }} | |
- name: Publish latest images | |
if: github.event_name != 'pull_request' && env.LATEST_VERSION == matrix.r_version | |
run: make --no-builtin-rules push-latest R_VERSION=${{ matrix.r_version }} |