name: Deploy live on: push: branches: - main concurrency: group: importarr-live cancel-in-progress: false jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.13" - uses: actions/setup-node@v4 with: node-version: "22" cache: npm cache-dependency-path: frontend/package-lock.json - name: Install dependencies run: | python -m pip install '.[test]' npm --prefix frontend ci - name: Test and build run: | python -m pytest -q npm --prefix frontend test -- --run npm --prefix frontend run build sh -n deploy/systemd-install.sh sh -n deploy/repo-upgrade.sh deploy: needs: test runs-on: ubuntu-latest steps: - name: Configure deployment SSH shell: bash env: DEPLOY_KEY: ${{ secrets.IMPORTARR_DEPLOY_SSH_KEY }} KNOWN_HOSTS: ${{ secrets.IMPORTARR_DEPLOY_KNOWN_HOSTS }} run: | install -d -m 0700 ~/.ssh install -m 0600 /dev/null ~/.ssh/id_ed25519 printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/id_ed25519 printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts - name: Deploy origin/main env: DEPLOY_HOST: ${{ secrets.IMPORTARR_DEPLOY_HOST }} DEPLOY_PORT: ${{ secrets.IMPORTARR_DEPLOY_PORT }} DEPLOY_USER: ${{ secrets.IMPORTARR_DEPLOY_USER }} run: >- ssh -p "$DEPLOY_PORT" -o BatchMode=yes "$DEPLOY_USER@$DEPLOY_HOST" sudo -n /bin/sh -c 'set -eu; cd /opt/importarr/repo; test -z "$(git status --porcelain)"; git fetch --prune origin main; git checkout -B main origin/main; exec /bin/sh deploy/repo-upgrade.sh'