Skip to content

Add some basic logging to track usage & leaks #18

Add some basic logging to track usage & leaks

Add some basic logging to track usage & leaks #18

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
build:
name: Build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- run: npm ci
- run: npm run build
- run: npm test
deploy:
name: Deploy to production
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment: production
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # Required to publish containers to GHCR
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: |
ghcr.io/httptoolkit/public-endpoint
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha
- name: Build & publish image to registry
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: GIT_HASH=${{ github.sha }}
- name: Configure Kubectl
run: |
kubectl config set-cluster scw-cluster \
--server="${{ vars.K8S_SERVER_ADDRESS }}" \
--certificate-authority=<(echo "${{ vars.K8S_CA_CERT }}" | base64 -d) \
--embed-certs=true
kubectl config set-credentials deployer --token="${{ secrets.K8S_DEPLOY_TOKEN }}"
kubectl config set-context default --cluster=scw-cluster --user=deployer
kubectl config use-context default
- name: Deploy to Kubernetes
run: |
sed "s|/public-endpoint:latest|/public-endpoint:sha-${GITHUB_SHA::7}|g" deploy/deployment.yaml | \
kubectl apply -f - \
-f deploy/service.yaml \
-f deploy/routes.yaml
- name: Verify Deployment
run: |
kubectl rollout status deployment/public-endpoint -n public-endpoint