Files
com.xaymar.www/.github/workflows/upload.yml
T
Michael Fabian 'Xaymar' Dirks b67be20d1e Automatically publish updates
2023-12-25 12:41:49 +01:00

64 lines
1.7 KiB
YAML

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/"