Skip to content

fix(packages/ui): update radix-ui-primitives monorepo (#1384) #19

fix(packages/ui): update radix-ui-primitives monorepo (#1384)

fix(packages/ui): update radix-ui-primitives monorepo (#1384) #19

Workflow file for this run

name: 🚀 Deploy Main
permissions:
contents: read
packages: write
deployments: write
on:
push:
branches:
- main
# Ensure only one production deployment runs at a time for the main branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate_secrets:
name: 🔒 Validate Secrets
uses: ./.github/workflows/validate-secrets.yml
secrets: inherit
with:
environment: production
deploy:
name: 🚀 Build and Deploy app to Fly.io (Production)
runs-on: ubuntu-latest
environment: production # Specifies the GitHub deployment environment
needs: validate_secrets
steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for flyctl release naming
- name: Prepare Repository Variables
id: vars
uses: ./.github/actions/prepare-repo-variables
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# ─────────────────────────────────────────────────────────────
# Auto-generate tags & OCI labels (sha + latest) – output id=meta
# ─────────────────────────────────────────────────────────────
- name: Extract image metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ steps.vars.outputs.IMAGE_NAME_MAIN }}
tags: |
type=sha,prefix=
type=raw,latest
labels: |
org.opencontainers.image.title=suddenlygiovanni-dev
org.opencontainers.image.description=Production image for suddenlygiovanni-dev
org.opencontainers.image.url=https://github.com/${{ github.repository }}
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}#readme
org.opencontainers.image.url=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
- name: 🐳 Build and Push Docker Image for Production
id: docker_build_push
uses: docker/build-push-action@v6
timeout-minutes: 20
with:
context: .
file: ./packages/app/Dockerfile
target: production
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
attests: |
type=provenance,mode=max
type=sbom
# ─── Cache strategy ────────────────────────────────────
# 1. Re-use layers from previous main build
# 2. Otherwise fall back to the long-living generic cache
cache-from: |
type=gha,scope=main
type=registry,ref=${{ steps.vars.outputs.IMAGE_TAG_MAIN_LATEST }}
type=registry,ref=${{ steps.vars.outputs.CACHE_IMAGE_NAME }}:latest
# Publish layers to both "main-latest" and the generic cache
cache-to: |
type=gha,scope=main,mode=max
type=registry,ref=${{ steps.vars.outputs.IMAGE_TAG_MAIN_LATEST }},mode=max
type=registry,ref=${{ steps.vars.outputs.CACHE_IMAGE_NAME }}:latest,mode=max
- name: 📠 Setup flyctl
uses: superfly/flyctl-actions/[email protected]
- name: 🚢 Deploy to Production using Pre-built Image
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
FLY_ORG: personal
FLY_REGION: ams
run: |
# Deploy using the specific image tag we just built and pushed
flyctl deploy \
--config ./packages/app/fly.yaml \
--image ${{ steps.vars.outputs.IMAGE_NAME_MAIN }}@${{ steps.docker_build_push.outputs.digest }}
- name: 📢 Create GitHub deployment
if: success()
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: deployment } = await github.rest.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.sha,
environment: 'production',
auto_merge: false,
required_contexts: []
});
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.id,
state: 'success',
environment_url: 'https://app.fly.dev',
log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
description: 'Production deployment completed successfully'
});