onboradinng #25
This file contains hidden or 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: Deploy GUI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'packages/gui/**' | |
| - '.github/workflows/deploy-gui.yml' | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Setup Rust Toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: wasm32-unknown-unknown | |
| override: true | |
| - name: Install wasm-pack | |
| uses: qmaru/wasm-pack-action@v0.5.0 | |
| with: | |
| version: 'latest' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --ignore-scripts | |
| - name: Test Core (cargo) | |
| run: | | |
| cd packages/core | |
| cargo test --quiet | |
| - name: Test Wrapper (vitest) | |
| run: pnpm --filter @notemine/wrapper test:run | |
| - name: Build GUI and dependencies | |
| run: pnpm --filter @notemine/gui... build | |
| - name: Setup SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.VPS_SSH_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| ssh-keyscan -p ${{ secrets.VPS_SSH_PORT || 22 }} -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts | |
| - name: Install Ansible | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ansible | |
| - name: Run Ansible playbook | |
| run: | | |
| cd ansible | |
| ansible-playbook -i inventory.yml playbook-gui.yml \ | |
| --extra-vars "gui_dist_path=../packages/gui/dist" \ | |
| --extra-vars "ansible_user=${{ secrets.VPS_USER }}" \ | |
| --extra-vars "ansible_host=${{ secrets.VPS_HOST }}" \ | |
| --extra-vars "ansible_port=${{ secrets.VPS_SSH_PORT || 22 }}" | |
| env: | |
| ANSIBLE_HOST_KEY_CHECKING: False |