Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 225 additions & 0 deletions .github/masterci.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
name: Test
on:
push:
branches:
- dev

concurrency:
group: ${{ github.workflow }}

env:
REGION: europe-west2
IMAGE_TAG: ${{ github.sha }}
REPOSITORY: gha-build-artifacts

jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read

outputs:
client: ${{ steps.filter.outputs.client }}
klaviyo: ${{ steps.filter.outputs.klaviyo }}

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
client:
- 'apps/client/**'
klaviyo:
- 'apps/klaviyo/**'

build-client:
needs: changes
name: Build and push Client docker image
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

env:
PROJECT_ID: yuzu-development-client
SERVICE: client

steps:
- name: Checkout
uses: actions/checkout@v4



- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Authenticate Docker to Google Cloud Artifact Registry
- name: Docker Auth
id: docker-auth
uses: docker/login-action@v3
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ env.REGION }}-docker.pkg.dev'

# Build and push the Docker image to Google Cloud Artifact Registry
- name: Build Docker image
id: docker-build
uses: docker/build-push-action@v5
with:
context: ./
file: ./apps/${{ env.SERVICE }}/Dockerfile
target: runner # Set the desired build target here
push: true
tags: |
${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
"ALGOLIA_APPLICATION_ID=${{ secrets.CORE_ALGOLIA_APP_ID }}"
"ALGOLIA_API_KEY=${{ secrets.CORE_ALGOLIA_PUBLIC_API_KEY }}"
"NUXT_ALGOLIA_API_KEY=${{ secrets.CORE_ALGOLIA_API_KEY }}"

build-klaviyo:
needs: changes
if: ${{ needs.changes.outputs.klaviyo == 'true' || needs.changes.outputs.sdk == 'true' }}
name: Build and push Klaviyo docker image
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

env:
PROJECT_ID: yuzu-development-klaviyo
SERVICE: klaviyo

steps:
- name: Checkout
uses: actions/checkout@v4



- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Authenticate Docker to Google Cloud Artifact Registry
- name: Docker Auth
id: docker-auth
uses: docker/login-action@v3
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ env.REGION }}-docker.pkg.dev'

# Build and push the Docker image to Google Cloud Artifact Registry
- name: Build Docker image
id: docker-build
uses: docker/build-push-action@v5
with:
context: ./
file: ./apps/${{ env.SERVICE }}/Dockerfile
target: runner # Set the desired build target here
push: true
tags: |
${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max

needs: changes
if: ${{ needs.changes.outputs.skulabs == 'true' || needs.changes.outputs.sdk == 'true' }}
name: Build and push SKULabs docker image
runs-on: ubuntu-latest
environment: development
permissions:
contents: read
id-token: write

env:
PROJECT_ID: yuzu-development-skulabs
SERVICE: skulabs

steps:
- name: Checkout
uses: actions/checkout@v4



- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Authenticate Docker to Google Cloud Artifact Registry
- name: Docker Auth
id: docker-auth
uses: docker/login-action@v3
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ env.REGION }}-docker.pkg.dev'

# Build and push the Docker image to Google Cloud Artifact Registry
- name: Build Docker image
id: docker-build
uses: docker/build-push-action@v5
with:
context: ./
file: ./apps/${{ env.SERVICE }}/Dockerfile
target: runner # Set the desired build target here
push: true
tags: |
${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max

deploy-client:
name: Deploy Client
runs-on: ubuntu-latest
needs: [build-client]
permissions:
id-token: write

env:
PROJECT_ID: yuzu-development-client
SERVICE: client

outputs:
url: ${{ steps.deploy-client.outputs.url }}

steps:
- name: Deploy Client to Cloud Run
id: deploy-client
uses: google-github-actions/deploy-cloudrun@v2
with:
project_id: ${{ env.PROJECT_ID }}
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
image: ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}

deploy-klaviyo:
name: Deploy Klaviyo
runs-on: ubuntu-latest
needs: [build-klaviyo]
permissions:
id-token: write

env:
PROJECT_ID: yuzu-development-klaviyo
SERVICE: klaviyo

outputs:
url: ${{ steps.deploy-klaviyo.outputs.url }}

steps:
- name: Deploy Klaviyo to Cloud Run
id: deploy-klaviyo
uses: google-github-actions/deploy-cloudrun@v2
with:
project_id: ${{ env.PROJECT_ID }}
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
image: ${{ env.REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI
on:
pull_request:
branches: [dev]
branches: [main]
types: [opened, synchronize, reopened]

permissions:
Expand Down Expand Up @@ -36,5 +36,11 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Setup environment
run: |
mkdir -p .env
cp .github/env/.env.ci .env/.env
env:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
- name: Build
run: pnpm build
118 changes: 118 additions & 0 deletions .github/workflows/masterci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Test
on:
pull_request:
branches: [dev]
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}

env:
REGION: europe-west2
IMAGE_TAG: ${{ github.sha }}
REPOSITORY: gha-build-artifacts

jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read

outputs:
client: ${{ steps.filter.outputs.client }}

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
client:
- 'apps/client/**'

build:
needs: changes
# if: ${{ needs.changes.outputs.client == 'true' }}
name: Build and Test
timeout-minutes: 15
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "metafest"

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
path: apps/client/.next
retention-days: 1

deploy-client:
name: Deploy Client
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: apps/client

env:
CLERK_API_KEY: ${{ secrets.CLERK_API_KEY }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

steps:
- name: Check out code
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 8

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-output
path: apps/client/.next

- name: Install Vercel CLI
run: pnpm install -g vercel

- name: Pull Vercel Environment Variables
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
Loading