From b67be20d1e26fa72bee998d5b27717018ebb9fad Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 25 Dec 2023 12:41:49 +0100 Subject: [PATCH] Automatically publish updates --- .github/workflows/upload.yml | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/upload.yml diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 0000000..d1a0054 --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,63 @@ +name: "Build & Publish" + +on: [push] + +concurrency: + group: build-publish + cancel-in-progress: false + +jobs: + build: + name: "Build" + runs-on: "ubuntu-22.04" + strategy: + fail-fast: true + steps: + - name: "Clone" + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + - name: "Install Build Tools" + shell: bash + run: | + sudo apt-get update + sudo apt-get install ruby-full build-essential zlib1g-dev + echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc + echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc + echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc + source ~/.bashrc + gem install jekyll bundler + - name: "Build" + shell: bash + run: | + bundle exec jekyll clean --destination build + bundle exec jekyll build --destination build + - name: "Upload Artifact" + uses: actions/upload-artifact@v4 + with: + path: "build/" + if-no-files-found: error + retention-days: 7 + compression-level: 0 + publish: + name: "Publish" + runs-on: "ubuntu-22.04" + strategy: + fail-fast: true + steps: + - name: "Download Artifact" + uses: actions/download-artifact@v4 + with: + merge-multiple: true + - name: "Restore SSH Key" + shell: bash + run: | + echo "${{ secrets.SSHKEY }}" | base64 -d > ~/.ssh/id_ed25519 + echo "Host xaymar.com" >> ~/.ssh/config + echo " StrictHostKeyChecking no" >> ~/.ssh/config + - name: "Publish" + shell: bash + run: | + rsync -v -h -P -a --delete . "com.xaymar@xaymar.com:/var/www/com.xaymar/public/com.xaymar.www/" +