Build Docker Image & Deploy to Vercel #38
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 Docker Image & Deploy to Vercel | |
on: | |
workflow_run: | |
workflows: ['Publish NPM Packages'] | |
types: | |
- completed | |
env: | |
UI_REGISTRY: ghcr.io | |
UI_IMAGE_NAME: ${{ github.repository }}/ui | |
jobs: | |
build-and-push: | |
name: Build and Push Image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.UI_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
env: | |
VERSION: ${{ github.ref_name }} | |
run: | | |
docker build -t ${{ env.UI_REGISTRY }}/${{ env.UI_IMAGE_NAME }}:$VERSION -f packages/ui/Dockerfile . | |
docker tag ${{ env.UI_REGISTRY }}/${{ env.UI_IMAGE_NAME }}:$VERSION ${{ env.UI_REGISTRY }}/${{ env.UI_IMAGE_NAME }}:latest | |
docker push ${{ env.UI_REGISTRY }}/${{ env.UI_IMAGE_NAME }}:$VERSION | |
docker push ${{ env.UI_REGISTRY }}/${{ env.UI_IMAGE_NAME }}:latest | |
deploy-to-vercel: | |
name: Deploy to Vercel | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Deploy to Vercel | |
uses: amondnet/vercel-action@v20 | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | |
vercel-args: '--prod' |