From 62c8aa6116d83b3a0f108fbc57f2f4abe9503147 Mon Sep 17 00:00:00 2001 From: Michael Buhler Date: Tue, 3 Dec 2024 21:25:07 +0700 Subject: [PATCH] ci: build and copy files to econosim.org --- .github/workflows/build.yaml | 34 ++++++++++++++++++++++++++++++++++ .vscode/settings.json | 5 +++++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .vscode/settings.json diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..83e73ca --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,34 @@ +name: Build and Copy to Server + +on: + push: + branches: + - master + +jobs: + build-and-scp: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: package-lock.json + - env: + RSA_PRIVATE_KEY: ${{ secrets.SSH_RSA_PRIVATE_KEY }} + KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }} + run: | + mkdir -p ~/.ssh + echo "$RSA_PRIVATE_KEY" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo "$KNOWN_HOSTS" > ~/.ssh/known_hosts + chmod 600 ~/.ssh/known_hosts + - run: npm install + - run: npm run build + - run: | + ssh econosim@econosim.org rm -frv /www/econosim.org/econosim.org/static + scp \ + -r \ + build/* \ + econosim@econosim.org:/www/econosim.org/econosim.org diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4e3d5fe --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.autoSave": "onFocusChange", + "editor.formatOnPaste": true, + "editor.formatOnSave": true +} \ No newline at end of file