diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4463fe8..6b450b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,11 +7,12 @@ on: branches: ['master'] jobs: + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: temurin java-version: 21 @@ -20,8 +21,8 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: temurin java-version: 21 @@ -30,8 +31,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: temurin java-version: 21 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6109857 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 < /home/lichess-search" + # run: cat lila-engine | ssh deploy-host "cat - > /home/lila-search && chown -R lila-search:lila-search && systemctl restart lila-search"