-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from lichess-org/auto-deploy
Auto deploy
- Loading branch information
Showing
2 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: Target environment for deployment | ||
required: true | ||
type: choice | ||
options: | ||
- sirch | ||
|
||
jobs: | ||
|
||
# todo | ||
# - split between lila-search / lila-search-ingestor | ||
# - only build when have success build | ||
# - auto matically run on tag or workflow_dispatch | ||
# - tpolecat release mode | ||
stage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 21 | ||
- run: sbt stage | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: lila-search | ||
path: modules/app/target/universal/stage | ||
|
||
deploy-lila-search: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ inputs.environment }} | ||
concurrency: | ||
group: ${{ inputs.environment }} | ||
needs: stage | ||
if: github.event_name == 'workflow_dispatch' | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: lila-search | ||
- name: Configure SSH | ||
run: | | ||
mkdir -p ~/.ssh | ||
touch ~/.ssh/id_deploy | ||
chmod 600 ~/.ssh/id_deploy | ||
echo "$SSH_KEY" > ~/.ssh/id_deploy | ||
echo "$SSH_HOST $SSH_HOST_KEY" > ~/.ssh/known_hosts | ||
cat >>~/.ssh/config <<END | ||
Host deploy-host | ||
HostName $SSH_HOST | ||
User $SSH_USER | ||
IdentityFile ~/.ssh/id_deploy | ||
StrictHostKeyChecking yes | ||
END | ||
env: | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
SSH_HOST: ${{ secrets.SSH_HOST }} | ||
SSH_USER: ${{ secrets.SSH_USER }} | ||
SSH_HOST_KEY: ${{ secrets.SSH_HOST_KEY }} | ||
- name: Deploy via SSH | ||
|
||
# ssh $REMOTE "chown -R lila-search:lila-search /home/lila-search && systemctl restart lila-search" | ||
run: cat lila-engine | ssh deploy-host "cat - > /home/lichess-search" | ||
# run: cat lila-engine | ssh deploy-host "cat - > /home/lila-search && chown -R lila-search:lila-search && systemctl restart lila-search" |