2024-02-04 14:18:54 +01:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened, closed]
|
|
|
|
push:
|
2024-01-13 17:48:08 +01:00
|
|
|
jobs:
|
|
|
|
web:
|
|
|
|
runs-on: ubuntu-latest
|
2024-02-04 14:23:10 +01:00
|
|
|
permissions:
|
|
|
|
pull-requests: write # allow surge-preview to create/update PR comments
|
2024-01-13 17:48:08 +01:00
|
|
|
env:
|
|
|
|
BUNDLE_GEMFILE: ${{ github.workspace }}/web/Gemfile
|
|
|
|
steps:
|
|
|
|
- name: Clone repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Setup Ruby
|
|
|
|
uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: 3.2.2
|
|
|
|
bundler-cache: true
|
|
|
|
- name: Build
|
|
|
|
run: cd web && bundle exec jekyll build
|
2024-02-04 14:18:54 +01:00
|
|
|
|
|
|
|
- name: Preview
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
uses: afc163/surge-preview@v1
|
|
|
|
with:
|
|
|
|
surge_token: ${{ secrets.SURGE_TOKEN }}
|
|
|
|
dist: web/_site
|
|
|
|
teardown: true
|
|
|
|
build: echo # see https://github.com/afc163/surge-preview/issues/231
|
2024-01-13 17:48:08 +01:00
|
|
|
|
|
|
|
# this is a beautiful way to deploy a website and i will not take any criticism
|
|
|
|
- name: Deploy
|
|
|
|
if: github.event_name == 'push' && github.ref_name == 'main'
|
|
|
|
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
|
2024-05-03 15:45:40 +02:00
|
|
|
rsync -rv --delete -e 'ssh -o "ProxyCommand cloudflared access ssh --hostname %h" -o "StrictHostKeyChecking=no"' web/_site/. ellbot@ssh.ellpeck.de:/var/www/tinylifegame
|
|
|
|
- name: Purge Cloudflare cache
|
|
|
|
uses: NathanVaughn/actions-cloudflare-purge@v3.1.0
|
|
|
|
with:
|
|
|
|
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
|
|
|
|
cf_auth: ${{ secrets.CLOUDFLARE_TOKEN }}
|
|
|
|
|
2024-01-13 17:48:08 +01:00
|
|
|
docs:
|
|
|
|
runs-on: ubuntu-latest
|
2024-02-04 14:23:10 +01:00
|
|
|
permissions:
|
|
|
|
pull-requests: write # allow surge-preview to create/update PR comments
|
2024-01-13 17:48:08 +01:00
|
|
|
steps:
|
|
|
|
- name: Clone repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Setup .NET
|
|
|
|
uses: actions/setup-dotnet@v3
|
|
|
|
with:
|
|
|
|
dotnet-version: 7.0.305
|
|
|
|
- name: Build
|
|
|
|
run: cd docs && dotnet tool restore && dotnet docfx
|
2024-02-04 14:18:54 +01:00
|
|
|
|
|
|
|
- name: Preview
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
uses: afc163/surge-preview@v1
|
|
|
|
with:
|
|
|
|
surge_token: ${{ secrets.SURGE_TOKEN }}
|
|
|
|
dist: docs/_site
|
|
|
|
teardown: true
|
|
|
|
build: echo # see https://github.com/afc163/surge-preview/issues/231
|
2024-01-13 17:48:08 +01:00
|
|
|
|
|
|
|
# this is a beautiful way to deploy a website and i will not take any criticism
|
|
|
|
- name: Deploy
|
|
|
|
if: github.event_name == 'push' && github.ref_name == 'main'
|
|
|
|
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"' docs/_site/. ellbot@ssh.ellpeck.de:/var/www/tinylifedocs
|
2024-05-03 15:45:40 +02:00
|
|
|
- name: Purge Cloudflare cache
|
|
|
|
uses: NathanVaughn/actions-cloudflare-purge@v3.1.0
|
|
|
|
with:
|
|
|
|
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
|
|
|
|
cf_auth: ${{ secrets.CLOUDFLARE_TOKEN }}
|