Skip to content

deps: bump astro from 6.4.6 to 6.4.7 in the production-deps group #66

deps: bump astro from 6.4.6 to 6.4.7 in the production-deps group

deps: bump astro from 6.4.6 to 6.4.7 in the production-deps group #66

Workflow file for this run

name: CI
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Check formatting
run: npm run format:check
- name: Build site
run: npm run build
- name: Upload dist artifact
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: website-dist
path: dist
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT || '22' }}
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
steps:
- name: Download dist artifact
uses: actions/download-artifact@v4
with:
name: website-dist
path: dist
- name: Validate deploy secrets
run: |
set -euo pipefail
DEPLOY_TARGET="${DEPLOY_PATH%/}"
test -n "$DEPLOY_HOST"
test -n "$DEPLOY_USER"
test -n "$DEPLOY_PORT"
test -n "$DEPLOY_TARGET"
test -n "$DEPLOY_SSH_KEY"
if [ "$DEPLOY_TARGET" = "/" ]; then
echo "DEPLOY_PATH must not be /"
exit 1
fi
- name: Configure SSH
run: |
set -euo pipefail
mkdir -p ~/.ssh
printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -p "$DEPLOY_PORT" "$DEPLOY_HOST" >> ~/.ssh/known_hosts
- name: Prepare remote directory
run: |
set -euo pipefail
DEPLOY_TARGET="${DEPLOY_PATH%/}"
DEPLOY_TMP="${DEPLOY_TARGET}/.deploy-tmp"
REMOTE_DEPLOY_PATH="$(printf '%q' "$DEPLOY_TARGET")"
REMOTE_DEPLOY_TMP="$(printf '%q' "$DEPLOY_TMP")"
ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" "$DEPLOY_USER@$DEPLOY_HOST" \
"DEPLOY_PATH=$REMOTE_DEPLOY_PATH DEPLOY_TMP=$REMOTE_DEPLOY_TMP bash -s" <<'EOF'
set -euo pipefail
if [ -z "$DEPLOY_PATH" ] || [ "$DEPLOY_PATH" = "/" ] || [ -z "$DEPLOY_TMP" ]; then
echo "DEPLOY_PATH must not be empty or /"
exit 1
fi
mkdir -p "$DEPLOY_PATH"
rm -rf "$DEPLOY_TMP"
mkdir -p "$DEPLOY_TMP"
EOF
- name: Upload dist via SCP
run: |
set -euo pipefail
DEPLOY_TARGET="${DEPLOY_PATH%/}"
DEPLOY_TMP="${DEPLOY_TARGET}/.deploy-tmp"
scp -i ~/.ssh/deploy_key -P "$DEPLOY_PORT" -r dist/. \
"$DEPLOY_USER@$DEPLOY_HOST:${DEPLOY_TMP}/"
- name: Publish release
run: |
set -euo pipefail
DEPLOY_TARGET="${DEPLOY_PATH%/}"
DEPLOY_TMP="${DEPLOY_TARGET}/.deploy-tmp"
REMOTE_DEPLOY_PATH="$(printf '%q' "$DEPLOY_TARGET")"
REMOTE_DEPLOY_TMP="$(printf '%q' "$DEPLOY_TMP")"
ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" "$DEPLOY_USER@$DEPLOY_HOST" \
"DEPLOY_PATH=$REMOTE_DEPLOY_PATH DEPLOY_TMP=$REMOTE_DEPLOY_TMP bash -s" <<'EOF'
set -euo pipefail
if [ -z "$DEPLOY_PATH" ] || [ "$DEPLOY_PATH" = "/" ] || [ -z "$DEPLOY_TMP" ]; then
echo "DEPLOY_PATH must not be empty or /"
exit 1
fi
mkdir -p "$DEPLOY_PATH"
find "$DEPLOY_PATH" -mindepth 1 -maxdepth 1 ! -name ".deploy-tmp" -exec rm -rf {} +
cp -a "$DEPLOY_TMP/." "$DEPLOY_PATH/"
rm -rf "$DEPLOY_TMP"
EOF