Skip to content

CI

CI #4

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
inputs:
environment:
required: true
type: choice
options:
- bwrdd
- terra
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
cache-from: type=gha
cache-to: type=gha
outputs: type=local,dest=dist
- uses: actions/upload-artifact@v4
with:
name: lila-tablebase
path: dist/usr/local/bin/lila-tablebase
deploy:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
concurrency:
group: ${{ inputs.environment }}
needs: build
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/download-artifact@v4
with:
name: lila-tablebase
- name: Configure SSH
run: |
mkdir -p ~/.ssh
touch ~/.ssh/deploy.key
chmod 600 ~/.ssh/deploy.key
echo "$SSH_KEY" > ~/.ssh/deploy.key
cat >>~/.ssh/config <<END
Host deploy-host
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/deploy.key
StrictHostKeyChecking no
END
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
- name: Deploy via SSH
run: cat lila-tablebase | ssh deploy-host "mv /usr/local/bin/lila-tablebase /usr/local/bin/lila-tablebase.bak && cat - > /usr/local/bin/lila-tablebase && chmod +x /usr/local/bin/lila-tablebase && systemctl restart lila-tablebase"