Skip to content

πŸš€ Deploy frontend #3110

πŸš€ Deploy frontend

πŸš€ Deploy frontend #3110

name: πŸš€ Deploy frontend
on:
workflow_run:
workflows:
- 'Frontend CI'
branches:
- main
types: [completed]
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-24.04-arm
timeout-minutes: 80
permissions:
packages: write
concurrency:
group: arm64-build_push_docker_frontend_prod
cancel-in-progress: true
steps:
# 2025-02-02: needs: 20 GB, post-cleanup-avail: 57G
- name: Free up space
run: |
sudo du -xh --max-depth=3 / 2>/dev/null | sort -rh | head -40 || true
sudo rm -rf /usr/share/swift /usr/lib/jvm /opt/* \
/usr/lib/dotnet /usr/share/az_* /usr/local/lib/android \
/usr/local/lib/android /usr/share/dotnet \
/usr/local/share/boost /usr/local/share/powershell \
/usr/lib/google-cloud-sdk /var/lib/apt/lists/*
sudo apt-get clean
df -h|grep "/dev/root"
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push production image
uses: docker/build-push-action@v6
with:
context: frontend
file: frontend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
load: true
no-cache: true
platforms: linux/arm64
provenance: false
build-args: |
NEXT_PUBLIC_IS_PRODUCTION=true
ENABLE_SENTRY=true
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
GITHUB_SHA=${{ github.sha }}
REDIS_URL=redis://frontend-cache.flathub.svc.cluster.local:6379
tags: |
ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}-arm64
ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/frontend:arm64-latest
ghcr.io/${{ github.repository_owner }}/frontend:latest
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=ssh://[email protected]:${{ github.repository }}.git
org.opencontainers.image.url=https://github.com/${{ github.repository }}
- name: Extract and upload assets
if: ${{ github.event_name != 'pull_request' }}
env:
ASSETS_SSH_PRIVATE_KEY: ${{ secrets.ASSETS_SSH_PRIVATE_KEY }}
run: |
eval $(ssh-agent -s)
ssh-add - <<< "$ASSETS_SSH_PRIVATE_KEY"
IMAGE="ghcr.io/${{ github.repository_owner }}/frontend:${{ github.sha }}-arm64"
CONTAINER_ID=$(docker create "$IMAGE")
docker cp "$CONTAINER_ID":/app/.next/static ./static
docker rm -f "$CONTAINER_ID"
mkdir -p ~/.ssh
ssh-keyscan -H hub.flathub.org >> ~/.ssh/known_hosts 2>/dev/null
rsync -avz ./static/ [email protected]:static/
rsync -avz ./frontend/public/ [email protected]:public/