build: update build instructions #118
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy site | |
on: | |
push: { branches: [master] } | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# if: github.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Restore file mtime | |
run: | | |
git ls-files -z | while read -d '' path; do | |
if [[ -e "$path" ]]; then | |
touch -d $(git log -1 --format="@%ct" "$path") "$path" | |
fi | |
done | |
- name: Install ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Install gems | |
run: gem install redcarpet rouge | |
- name: Set environment variables | |
run: echo "SITE_ROOT=deploy" >> $GITHUB_ENV | |
- name: Build (for forks) | |
if: ${{ github.repository_owner != 'lite-xl' }} | |
run: ruby site.rb "/$(echo '${{ github.repository }}' | cut -d/ -f2)" | |
- name: Build (for lite-xl org) | |
if: ${{ github.repository_owner == 'lite-xl' }} | |
run: ruby site.rb | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: website | |
path: ./deploy | |
compression-level: 9 | |
- name: Upload to GitHub pages (for lite-xl org) | |
if: ${{ github.repository_owner == 'lite-xl' && github.ref_name == 'master' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./deploy | |
cname: lite-xl.com | |
- name: Upload to GitHub pages (for forks) | |
if: ${{ github.repository_owner != 'lite-xl' && github.ref_name == 'master' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./deploy |