Files
bootstrap-auth-server/.gitea/workflows/deploy.yml

63 lines
1.7 KiB
YAML

name: Deployment Pipeline
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '.gitignore'
- 'docs/**'
jobs:
test:
runs-on: production
container:
image: rust:latest
steps:
- name: Install Dependencies
run: |
apt-get update
apt-get install -y git sqlite3
- name: Checkout Code
run: |
git config --global --add safe.directory '*'
rm -rf * .git || true
git clone --depth 1 $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git .
- name: Run Tests
run: cargo test
deploy:
needs: test
runs-on: production
steps:
- name: Checkout Code
run: |
git config --global --add safe.directory '*'
rm -rf * .git || true
git clone --depth 1 $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git .
- name: Build Docker Image
run: docker build -t bootstrap-auth-server:latest .
- name: Stop and Remove Existing Container
run: |
docker stop auth-server || true
docker rm auth-server || true
- name: Run New Container
run: |
# We map a local volume /opt/bootstrap-auth-server/data to persist the SQLite DB across deployments
docker run -d \
--name auth-server \
--restart unless-stopped \
-p 3000:3000 \
-e SERVER_PORT=3000 \
-e SERVER_MASTER_KEY="${{ secrets.SERVER_MASTER_KEY }}" \
-e SECRETS_FILE_PATH="/app/data/secrets.json" \
-v /opt/bootstrap-auth-server/data:/app/data \
-e DATABASE_URL="sqlite:///app/data/data.db?mode=rwc" \
bootstrap-auth-server:latest