This repository was archived by the owner on May 14, 2025. It is now read-only.
Bump @opentelemetry/instrumentation-express from 0.35.0 to 0.49.0 #113
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Install Playwright system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-4-1 libgraphene-1.0-0 libwoff1 libevent-2.1-7 libopus0 \ | |
libharfbuzz-icu0 libsecret-1-0 libhyphen0 libmanette-0.2-0 \ | |
libgles2 libx264-dev libavif-dev | |
- name: Install Playwright | |
run: pnpm exec playwright install --with-deps | |
- name: Build shared package | |
run: pnpm --filter shared build | |
- name: Type check | |
run: | | |
# Skip type checking for now and just build | |
pnpm --filter shared build | |
pnpm --filter server build --skipLibCheck | |
- name: Lint | |
run: pnpm --filter client lint | |
- name: End-to-end tests | |
run: pnpm e2e | |
- name: Build | |
run: pnpm build | |
deploy: | |
needs: validate | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set lowercase names | |
id: lowercase | |
run: | | |
echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
echo "repo=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ steps.lowercase.outputs.repo }} | |
- name: Build and push client image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ steps.lowercase.outputs.repo }}/client:latest | |
target: client | |
- name: Build and push server image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ steps.lowercase.outputs.repo }}/server:latest | |
target: server | |
- name: Copy Nginx config to VPS | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
username: ${{ secrets.VPS_USERNAME }} | |
key: ${{ secrets.VPS_SSH_KEY }} | |
source: "nginx/hackops.dracodev.me.conf" | |
target: "/tmp" | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
username: ${{ secrets.VPS_USERNAME }} | |
key: ${{ secrets.VPS_SSH_KEY }} | |
script: | | |
# Create app directory if it doesn't exist | |
mkdir -p ~/hackops-submission | |
cd ~/hackops-submission | |
# Create docker-compose file | |
echo 'version: "3.8"' > docker-compose.yml | |
echo '' >> docker-compose.yml | |
echo 'services:' >> docker-compose.yml | |
echo ' client:' >> docker-compose.yml | |
echo ' image: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ steps.lowercase.outputs.repo }}/client:latest' >> docker-compose.yml | |
echo ' ports:' >> docker-compose.yml | |
echo ' - "3000:3000"' >> docker-compose.yml | |
echo ' environment:' >> docker-compose.yml | |
echo ' - NODE_ENV=production' >> docker-compose.yml | |
echo ' depends_on:' >> docker-compose.yml | |
echo ' - server' >> docker-compose.yml | |
echo ' restart: unless-stopped' >> docker-compose.yml | |
echo '' >> docker-compose.yml | |
echo ' server:' >> docker-compose.yml | |
echo ' image: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ steps.lowercase.outputs.repo }}/server:latest' >> docker-compose.yml | |
echo ' ports:' >> docker-compose.yml | |
echo ' - "3001:3001"' >> docker-compose.yml | |
echo ' environment:' >> docker-compose.yml | |
echo ' - NODE_ENV=production' >> docker-compose.yml | |
echo ' command: node /app/server/index.js' >> docker-compose.yml | |
echo ' restart: unless-stopped' >> docker-compose.yml | |
# Pull latest images and restart containers | |
docker pull ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ steps.lowercase.outputs.repo }}/client:latest | |
docker pull ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ steps.lowercase.outputs.repo }}/server:latest | |
docker-compose down | |
docker-compose up -d | |
# Set up Nginx | |
# Install Nginx if not already installed | |
if ! command -v nginx &> /dev/null; then | |
apt-get update | |
apt-get install -y nginx | |
fi | |
# Copy Nginx configuration | |
cp /tmp/nginx/hackops.dracodev.me.conf /etc/nginx/sites-available/hackops.dracodev.me | |
# Create symbolic link if it doesn't exist | |
if [ ! -f /etc/nginx/sites-enabled/hackops.dracodev.me ]; then | |
ln -s /etc/nginx/sites-available/hackops.dracodev.me /etc/nginx/sites-enabled/ | |
fi | |
# Remove default site if it exists | |
if [ -f /etc/nginx/sites-enabled/default ]; then | |
rm /etc/nginx/sites-enabled/default | |
fi | |
# Test Nginx configuration | |
nginx -t | |
# Reload Nginx | |
systemctl reload nginx | |
# Install Certbot for SSL if not already installed | |
if ! command -v certbot &> /dev/null; then | |
apt-get update | |
apt-get install -y certbot python3-certbot-nginx | |
fi | |
# Set up SSL certificate | |
certbot --nginx -d hackops.dracodev.me --non-interactive --agree-tos --email [email protected] |