71 lines
1.5 KiB
YAML
71 lines
1.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint
|
|
|
|
- name: Test
|
|
run: npm test
|
|
|
|
deploy:
|
|
if: github.ref == 'refs/heads/main' && needs.test.result == 'success'
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Build frontend assets
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Build Python sdist
|
|
run: |
|
|
pip install build
|
|
python -m build --sdist
|
|
|
|
- name: Copy sdist to server
|
|
uses: appleboy/scp-action@v0.1.7
|
|
with:
|
|
host: mopidy-dev.service
|
|
username: root
|
|
key: ${{ secrets.JAIL_KEY }}
|
|
target: /tmp/iris-deploy/
|
|
source: dist/
|
|
|
|
- name: Install and restart
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: mopidy-dev.service
|
|
username: root
|
|
key: ${{ secrets.JAIL_KEY }}
|
|
script: |
|
|
pip uninstall -y --break-system-packages mopidy-iris
|
|
pip install --break-system-packages /tmp/iris-deploy/dist/*.tar.gz
|
|
rm -rf /tmp/iris-deploy
|
|
service mopidy restart
|