63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
name: 'Deploy quoter'
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- 6379:6379
|
|
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Rust
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
rustup component add rustfmt clippy
|
|
|
|
- name: Cache Cargo
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/
|
|
target/
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Quality Checks
|
|
run: |
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
cargo fmt --check
|
|
cargo clippy --all-targets -- -D warnings
|
|
|
|
- name: Build & Test
|
|
env:
|
|
REDIS_URL: "redis://localhost:6379"
|
|
run: |
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
cargo build --release
|
|
cargo test --all
|
|
|
|
- name: Setup SSH
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
chmod 700 ~/.ssh
|
|
printf '%s' "${{ secrets.STAGING_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H v3.dscrs.site >> ~/.ssh/known_hosts
|
|
eval $(ssh-agent -s)
|
|
ssh-add ~/.ssh/id_rsa
|
|
|
|
- name: Deploy
|
|
run: |
|
|
git remote add dokku ssh://dokku@v3.dscrs.site:22/quoter || git remote set-url dokku ssh://dokku@v3.dscrs.site:22/quoter
|
|
git push dokku dev:main -f
|