Temporary override vite #100
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
| # SPDX-FileCopyrightText: 2025 Håkon Løvdal <kode@denkule.no> | |
| # | |
| # SPDX-License-Identifier: GPL-3.0-or-later | |
| # This workflow will deploy to www.1maiprogram.no. | |
| name: Deploy | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [24.x] | |
| # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - run: npm clean-install | |
| - run: npm run build | |
| - name: Copy dist files to server | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| port: ${{ secrets.DEPLOY_PORT }} | |
| passphrase: ${{ secrets.DEPLOY_PASSPHRASE }} | |
| source: dist/1maiprogram/browser | |
| target: ${{ secrets.DEPLOY_WWW_PARENT_DIR }}/upload | |
| - name: Atomically replace old www directory with new | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| port: ${{ secrets.DEPLOY_PORT }} | |
| passphrase: ${{ secrets.DEPLOY_PASSPHRASE }} | |
| script: | | |
| set -euo pipefail | |
| cd ${{ secrets.DEPLOY_WWW_PARENT_DIR }} | |
| mkdir www.new | |
| mv upload/dist/1maiprogram/browser/* upload/dist/1maiprogram/browser/.??* www.new/. | |
| cp -ai www/.git* www.new/. | |
| cd www.new | |
| git add . | |
| # Git commit will return with non-zero exit code if there are no files to commit | |
| # (which is not necessarily an error, for instance when a new commit is pushed | |
| # that only changes this file, there will be nothing in the www directory changed). | |
| if ! git diff-index --cached --quiet HEAD; then git commit -m "$(date "+%Y-%m-%d_%H:%M")"; fi | |
| cd .. | |
| mv www www."$(date "+%Y-%m-%d_%H:%M")" | |
| mv www.new www |