Skip to content

Deploy Preview

Deploy Preview #8

name: Deploy Preview
on:
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened]
jobs:
deploy:
environment: deploypreview # todo::unify names
permissions:
contents: read # to fetch code (actions/checkout)
deployments: write # to delete deployments
pull-requests: write # to remove labels
statuses: write # to create commit status
name: deploy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY_PULL_PREVIEW_HOST }}
username: ${{ secrets.DOCKER_REGISTRY_PULL_PREVIEW_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PULL_PREVIEW_RW_PASSWORD }}
- name: Create Image Full Name
run: echo "image_full_name=docker://${{ secrets.DOCKER_REGISTRY_PULL_PREVIEW_HOST }}/${{ secrets.DOCKER_REGISTRY_PULL_PREVIEW_REPOSITORY }}:${{ github.sha }}" >> "$GITHUB_ENV"
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.image_full_name }}
context: examples/with-nextjs-and-clerk-auth
cache-from: type=gha
cache-to: type=gha,mode=max