Skip to content

Add landing page with auto-generated screenshots #94

Add landing page with auto-generated screenshots

Add landing page with auto-generated screenshots #94

Workflow file for this run

name: Deploy Application
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run linting
run: bun run check
- name: Check architecture boundaries
run: bun run check:boundaries
- name: Run type checking
run: bun run typecheck
- name: Run tests
run: bun run test
- name: Run component tests
run: bun run test:components:run
- name: Build frontend
run: bun run build:app
build-docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
needs: [build-and-test]
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Scaleway Container Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.SCW_REGISTRY_ENDPOINT }}
username: nologin
password: ${{ secrets.SCW_SECRET_KEY }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.SCW_REGISTRY_ENDPOINT }}/ws-scoring
tags: |
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy-container:
name: Deploy Container
runs-on: ubuntu-latest
needs: [build-docker]
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup OpenTofu
uses: opentofu/setup-opentofu@v1
with:
tofu_version: '1.6.0'
- name: Setup scaleway CLI
uses: scaleway/action-scw@v0
with:
save-config: true
export-config: true
version: v2.24.0
access-key: ${{ secrets.SCW_ACCESS_KEY }}
secret-key: ${{ secrets.SCW_SECRET_KEY }}
default-project-id: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
default-organization-id: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }}
- name: Get infrastructure outputs
working-directory: infrastructure
run: |
tofu init \
-backend-config="bucket=${{ secrets.TF_STATE_BUCKET }}" \
-backend-config="access_key=${{ secrets.SCW_ACCESS_KEY }}" \
-backend-config="secret_key=${{ secrets.SCW_SECRET_KEY }}" \
-backend-config="region=${{ secrets.SCW_DEFAULT_REGION }}" \
-backend-config="endpoint=https://s3.${{ secrets.SCW_DEFAULT_REGION }}.scw.cloud"
echo "NAMESPACE_ID=$(tofu output -raw container_namespace_id | sed 's/.*\///')" >> $GITHUB_ENV
CONTAINER_ID=$(scw container container list namespace-id=${{ env.NAMESPACE_ID }} -o json | jq -r '.[0].id // empty')
echo "CONTAINER_ID=$CONTAINER_ID" >> $GITHUB_ENV
- name: Deploy container
run: |
scw container container update ${{ env.CONTAINER_ID }} \
registry-image=${{ secrets.SCW_REGISTRY_ENDPOINT }}/ws-scoring:latest \
min-scale=0 \
max-scale=0
- name: Get container URL
run: |
# Wait a moment for container to be ready
sleep 5
CONTAINER_ID=$(scw container container list namespace-id=${{ env.NAMESPACE_ID }} -o json | jq -r '.[0].id')
CONTAINER_URL=$(scw container container get $CONTAINER_ID -o json | jq -r '.domain_name')
echo "CONTAINER_URL=https://$CONTAINER_URL" >> $GITHUB_ENV
- name: Display deployment info
run: |
echo "✅ Deployment successful!"
echo "🚀 Application URL: ${{ env.CONTAINER_URL }}"