Skip to content

Update new_project_from_json.R #82

Update new_project_from_json.R

Update new_project_from_json.R #82

name: pre-build-docker
# Build docker image for a PR (pre-build) containing a new job so that it can be previewed and tested.
# Current jobs should not need this because they already have a tailored build workflow in `main`.
on:
pull_request:
branches:
- '**'
env:
REGISTRY: ghcr.io
# all pr-builds are called pre-build
IMAGE: ghcr.io/${{ github.repository }}-pre-build
jobs:
build:
if: "contains(github.event.head_commit.message, '[pre-build]')"
runs-on: ubuntu-latest
env:
environment: "review"
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set env
run: |
DIFF=$( git diff --name-only HEAD~1 | head -n 1 )
echo "CONTEXT=$(dirname $DIFF)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ./${{ env.CONTEXT }}
tags: ${{ env.IMAGE }}:latest
push: true
platforms: linux/amd64