Skip to content

chore(deps): update dependency eslint-plugin-json to v4 #6087

chore(deps): update dependency eslint-plugin-json to v4

chore(deps): update dependency eslint-plugin-json to v4 #6087

name: Pull Request Preview Environment
on:
pull_request:
types: [labeled, synchronize, opened, reopened]
jobs:
build-preview-image:
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'preview') }}
env:
CLIENT_IMAGE_REPO: ghcr.io/elifesciences/enhanced-preprints-client
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build preview image
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
target: prod
platforms: linux/amd64,linux/arm64
tags: |
${{ env.CLIENT_IMAGE_REPO }}:preview-${{ github.event.number }}
- name: load preview image
uses: docker/build-push-action@v5
with:
context: .
target: prod
platforms: linux/amd64
load: true
tags: |
${{ env.CLIENT_IMAGE_REPO }}:preview-${{ github.event.number }}
- name: run image
run: docker run --rm -d --name "test_preview" -p 3000:3000 ${{ env.CLIENT_IMAGE_REPO }}:preview-${{ github.event.number }}
- name: test /status endpoint
run: curl --retry-all-errors --retry 5 http://localhost:3000/status
- name: clean up running image
run: docker stop test_preview
- name: Get current date
id: date
run: echo "date=$(date --utc +%Y%m%d.%H%M)" >> $GITHUB_OUTPUT
- name: Push preview image
uses: docker/build-push-action@v5
with:
context: .
target: prod
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.CLIENT_IMAGE_REPO }}:preview-${{ github.event.number }}
${{ env.CLIENT_IMAGE_REPO }}:preview-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}
${{ env.CLIENT_IMAGE_REPO }}:preview-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}-${{ steps.date.outputs.date }}