Skip to content

chore(deps): bump astro from 6.1.5 to 6.4.6 #1197

chore(deps): bump astro from 6.1.5 to 6.4.6

chore(deps): bump astro from 6.1.5 to 6.4.6 #1197

Workflow file for this run

name: 🐳 Build and deploy
on:
push:
branches:
- main
paths:
- "apps/web/**"
- "apps/uno/**"
- "packages/**"
- "pnpm-lock.yaml"
- "turbo.json"
- ".github/workflows/docker-publish.yaml"
pull_request:
branches:
- main
paths:
- "apps/web/**"
- "apps/uno/**"
- "packages/**"
- "pnpm-lock.yaml"
- "turbo.json"
- ".github/workflows/docker-publish.yaml"
concurrency:
group: docker-publish-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'main' }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
jobs:
create-pending-status:
if: github.event_name == 'pull_request' && github.event.pull_request.user.type != 'Bot'
name: 🟠 Set PR status to redeploying
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: 🟠 Update PR comment with redeploying status
uses: actions/github-script@v8
with:
script: |
const marker = '<!-- preview-env -->';
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
});
const existing = comments.find((c) => c.body.includes(marker));
if (existing) {
let body = existing.body;
if (body.includes('| Status |')) {
body = body.replace(/\| Status \|.*\|/, '| Status | 🟠 Redeploying... |');
} else {
body = body.replace(/(\|.*\|.*\|\n)(\n)/, '$1| Status | 🟠 Redeploying... |\n$2');
}
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
}
build-and-push-uno:
if: github.event_name == 'push' || github.event.pull_request.user.type != 'Bot'
name: 🐳 Build uno
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: uno
steps:
- name: πŸ” Checkout repository
uses: actions/checkout@v6
- name: πŸ” Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷️ Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr,prefix=pr-
- name: πŸ—οΈ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 Build and push uno
uses: docker/build-push-action@v6
with:
context: .
file: ./apps/uno/Dockerfile
target: web
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
build-and-push-uno-cron:
if: github.event_name == 'push' || github.event.pull_request.user.type != 'Bot'
name: 🐳 Build uno cron
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: uno-cron
steps:
- name: πŸ” Checkout repository
uses: actions/checkout@v6
- name: πŸ” Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷️ Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr,prefix=pr-
- name: πŸ—οΈ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 Build and push uno cron
uses: docker/build-push-action@v6
with:
context: .
file: ./apps/uno/Dockerfile
target: cron
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: GIT_COMMIT_SHA=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
build-and-push-web:
if: github.event_name == 'push' || github.event.pull_request.user.type != 'Bot'
name: 🐳 Build web
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: web
steps:
- name: πŸ” Checkout repository
uses: actions/checkout@v6
- name: πŸ” Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷️ Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr,prefix=pr-
- name: πŸ”— Set API URL
id: api-url
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "value=https://pr-${{ github.event.pull_request.number }}.uno.${{ secrets.PREVIEW_DOMAIN }}" >> $GITHUB_OUTPUT
else
echo "value=https://uno.echo-webkom.no" >> $GITHUB_OUTPUT
fi
- name: πŸ—ƒοΈ Set Sanity dataset
id: sanity-dataset
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "value=develop" >> $GITHUB_OUTPUT
else
echo "value=production" >> $GITHUB_OUTPUT
fi
- name: πŸ—οΈ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 Build and push web
uses: docker/build-push-action@v6
with:
context: .
file: ./apps/web/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_COMMIT_SHA=${{ github.sha }}
NEXT_PUBLIC_API_URL=${{ steps.api-url.outputs.value }}
NEXT_PUBLIC_SANITY_DATASET=${{ steps.sanity-dataset.outputs.value }}
NEXT_PUBLIC_UMAMI_URL=${{ secrets.NEXT_PUBLIC_UMAMI_URL }}
NEXT_PUBLIC_UMAMI_WEBSITE_ID=${{ secrets.NEXT_PUBLIC_UMAMI_WEBSITE_ID }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
# Migrator that only runs on PRs, since it is used to seed and migrate the preview environment, and is not needed for production deployments.
build-and-push-migrator:
if: github.event_name == 'pull_request' && github.event.pull_request.user.type != 'Bot'
name: 🐳 Build migrator
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
IMAGE_NAME: migrator
steps:
- name: πŸ” Checkout repository
uses: actions/checkout@v6
- name: πŸ” Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷️ Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=pr,prefix=pr-
- name: πŸ—οΈ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 🐳 Build and push migrator
uses: docker/build-push-action@v6
with:
context: .
file: ./packages/seeder/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
deploy-preview:
if: github.event_name == 'pull_request' && github.event.pull_request.user.type != 'Bot'
needs: [build-and-push-uno, build-and-push-web, build-and-push-migrator]
name: πŸš€ Deploy PR Preview
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: πŸ” Checkout repository
uses: actions/checkout@v6
with:
sparse-checkout: preview
- name: πŸ”‘ Setup SSH
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.VPS_SSH_KEY }}
- name: πŸ”’ Add VPS to known hosts
run: ssh-keyscan -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
- name: πŸ” Log in to GitHub Container Registry on VPS
env:
DOCKER_HOST: ssh://deploy@${{ secrets.VPS_HOST }}
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: πŸš€ Deploy preview stack
env:
DOCKER_HOST: ssh://deploy@${{ secrets.VPS_HOST }}
PR_NUMBER: ${{ github.event.pull_request.number }}
DB_PASSWORD: ${{ secrets.PREVIEW_DATABASE_PASSWORD }}
ADMIN_KEY: ${{ secrets.PREVIEW_ADMIN_KEY }}
AUTH_SECRET: ${{ secrets.AUTH_SECRET }}
FEIDE_CLIENT_ID: ${{ secrets.FEIDE_CLIENT_ID }}
FEIDE_CLIENT_SECRET: ${{ secrets.FEIDE_CLIENT_SECRET }}
PREVIEW_DOMAIN: ${{ secrets.PREVIEW_DOMAIN }}
GIT_COMMIT_SHA: ${{ github.sha }}
MINIO_ROOT_USER: ${{ secrets.MINIO_ROOT_USER }}
MINIO_ROOT_PASSWORD: ${{ secrets.MINIO_ROOT_PASSWORD }}
run: docker compose -p pr-${PR_NUMBER} -f preview/docker-compose.yaml up -d --pull always --wait
- name: πŸ’¬ Comment on PR
uses: actions/github-script@v8
env:
PREVIEW_DOMAIN: ${{ secrets.PREVIEW_DOMAIN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
with:
script: |
const marker = '<!-- preview-env -->';
const domain = process.env.PREVIEW_DOMAIN;
const prNumber = process.env.PR_NUMBER;
const body = [
marker,
'## Preview Environment',
'',
'| Project | URL |',
'|---------|-----|',
`| Frontend | <a href="https://pr-${prNumber}.web.${domain}" target="_blank">https://pr-${prNumber}.web.${domain}</a> |`,
`| Backend | <a href="https://pr-${prNumber}.uno.${domain}" target="_blank">https://pr-${prNumber}.uno.${domain}</a> |`,
`| Status | 🟒 Deployed |`,
'',
`_Deployed from \`${context.sha.slice(0, 7)}\` at ${new Date().toLocaleString('nb-NO', { timeZone: 'Europe/Oslo' })}_`,
].join('\n');
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
});
const existing = comments.find((c) => c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
body,
});
}
auto-deploy-web-uno:
name: πŸš— Auto deploy web
if: github.event_name == 'push' && github.ref_name == 'main'
needs: [build-and-push-web, build-and-push-uno]
runs-on: ubuntu-latest
steps:
- name: πŸ” Checkout
uses: actions/checkout@v6
- name: πŸ“¦ Setup pnpm
uses: pnpm/action-setup@v4
- name: 🐒 Setup node
uses: actions/setup-node@v6
with:
node-version: 22.22.0
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml
- name: πŸ“¦ Install dependencies
run: pnpm install --frozen-lockfile
- name: πŸ—οΈ Migrate database
run: pnpm db:migrate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- name: πŸš— Auto deploy web
run: curl ${{ secrets.DEPLOY_WEB_URL }}
- name: πŸš— Auto deploy uno
run: curl ${{ secrets.DEPLOY_UNO_URL }}
auto-deploy-cron:
name: πŸš— Auto deploy cron
if: github.event_name == 'push' && github.ref_name == 'main'
needs: [build-and-push-uno-cron]
runs-on: ubuntu-latest
steps:
- name: πŸš— Auto deploy cron
run: curl ${{ secrets.DEPLOY_CRON_URL }}