From f22dfa0ec4de4c055d5b689466b0f87485af7485 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 15 Sep 2024 23:18:17 +0200 Subject: [PATCH] always deploy the demo on push --- .github/workflows/web.yml | 47 ++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index bcb214e..1fc0083 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -22,7 +22,23 @@ jobs: name: demo include-hidden-files: true if-no-files-found: error - build-docs: + deploy-demo: + if: github.event_name == 'push' + needs: [build-demo] + runs-on: ubuntu-latest + steps: + - name: Download demo artifact + uses: actions/download-artifact@v4 + with: + name: demo + path: demo + - name: Deploy demo + # this is a beautiful way to deploy a website and i will not take any criticism + run: | + curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb + mkdir ~/.ssh && echo "${{ secrets.ELLBOT_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' demo/. ellbot@ssh.ellpeck.de:/var/www/MLEM/demo + build-deploy-docs: runs-on: ubuntu-latest steps: - name: Clone repository @@ -44,35 +60,10 @@ jobs: name: docs include-hidden-files: true if-no-files-found: error - deploy: - needs: [build-demo, build-docs] - runs-on: ubuntu-latest - steps: - - name: Download demo artifact - uses: actions/download-artifact@v4 - with: - name: demo - path: demo - - name: Download docs artifact - uses: actions/download-artifact@v4 - with: - name: docs - path: docs - - name: Combine sites - run: | - mv docs _site - mv demo _site/demo - - name: Upload combined artifact - uses: actions/upload-artifact@v4 - with: - path: _site - name: site - include-hidden-files: true - if-no-files-found: error - - name: Deploy + - name: Deploy docs if: startsWith(github.ref, 'refs/tags/') # this is a beautiful way to deploy a website and i will not take any criticism run: | curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb mkdir ~/.ssh && echo "${{ secrets.ELLBOT_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa - rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' _site/. ellbot@ssh.ellpeck.de:/var/www/MLEM + rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' --exclude /demo Docs/_site/. ellbot@ssh.ellpeck.de:/var/www/MLEM