Skip to content

feat(DEV-11582): deploy preview #10

feat(DEV-11582): deploy preview

feat(DEV-11582): deploy preview #10

name: Pull Preview Deploy
on:
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened]
jobs:
deploy:
environment: deploypreview # todo::unify names to 'pull-preview'
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=${{ secrets.DOCKER_REGISTRY_PULL_PREVIEW_HOST }}/${{ secrets.DOCKER_REGISTRY_PULL_PREVIEW_REPOSITORY }}:${{ github.sha }}" >> "$GITHUB_ENV"
- name: Get Turborepo service container IP
run: |
echo "turbo_api_ip=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Build and push Image
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
build-args: |
TURBO_API=http://${{ env.turbo_api_ip }}:41230
TURBO_TEAM=turbogha
TURBO_TOKEN=turbogha