feat: songTitle+artist match #1255
Workflow file for this run
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
name: Server CI/CD | |
on: | |
push: | |
branches: | |
- "main" | |
paths: | |
- "server/**" | |
- "common/**" | |
pull_request: | |
branches: | |
- "main" | |
paths: | |
- "server/**" | |
- "common/**" | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
NODE_ENV: "test" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 8.15.6 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm --filter tachi-server... --filter . install | |
- name: Lint code | |
run: pnpm --filter tachi-server lint | |
- name: Typecheck code | |
run: pnpm --filter tachi-server typecheck | |
# configure external dbs | |
- uses: supercharge/[email protected] | |
- uses: supercharge/[email protected] | |
- name: Run tests | |
run: pnpm --filter tachi-server test | |
env: | |
NODE_ENV: "test" | |
PORT: 8080 | |
MONGO_URL: "127.0.0.1" | |
REDIS_URL: "127.0.0.1" | |
docker-push: | |
runs-on: ubuntu-latest | |
needs: [test] | |
defaults: | |
run: | |
working-directory: ./server | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Docker Hub login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Commit Hash | |
run: 'echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV' | |
- name: Docker Tag | |
if: github.ref == 'refs/heads/main' | |
run: 'echo "DOCKER_TAG=stable" >> $GITHUB_ENV' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./ | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/tachi-server:${{ env.DOCKER_TAG }} | |
file: ./Dockerfile.server | |
build-args: | | |
COMMIT_HASH=${{ env.SHORT_SHA }} | |
cache-from: type=gha,scope=$GITHUB_REF_NAME-server | |
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-server | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [test, docker-push] | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
steps: | |
- name: Enable SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
sudo chmod 600 ~/.ssh/id_rsa | |
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts | |
env: | |
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} | |
SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} | |
- name: Deploy updates | |
run: ssh ci@"$TACHI_HOST" /home/ci/tachi-devops/scripts/deploy_server.sh | |
env: | |
TACHI_HOST: ${{secrets.TACHI_HOST}} |