Skip to content

Commit

Permalink
feat(build): use jekyll and restyle website
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Nov 3, 2024
1 parent 9471c7a commit 6e9b4ec
Show file tree
Hide file tree
Showing 70 changed files with 1,592 additions and 1,579 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ignore hidden files
.*

_site/
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ensure dockerfiles are checked out with LF line endings
Dockerfile text eol=lf
*.dockerfile text eol=lf
86 changes: 57 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,59 @@ on:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
update:
build:
name: Build Jekyll
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'

- name: Install dependencies
run: |
bundle install
- name: Setup Pages
id: configure-pages
uses: actions/configure-pages@v5

- name: Setup CI config
run: |
echo "---" > _config_ci.yml
echo "baseurl: ${{ steps.configure-pages.outputs.base_path }}" >> _config_ci.yml
- name: Build site
env:
JEKYLL_ENV: production
PAGES_REPO_NWO: ${{ github.repository }}
run: |
bundle exec jekyll build --future --config _config_ci.yml,_config.yml
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: site
path: _site
if-no-files-found: error
retention-days: 1

deploy:
name: Deploy to Pages
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
Expand All @@ -25,39 +70,22 @@ jobs:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token
fetch-depth: 0 # otherwise, will fail to push refs to dest repo

- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

- name: Build website
- name: Clean
run: |
# install npm dependencies
npm install
# empty contents of gh-pages
rm -f -r ./gh-pages/*
# move contents of dist to gh-pages
# https://stackoverflow.com/a/20192079/11214013
cp -r ./dist/. ./gh-pages/
# move node_modules directory to gh-pages
mv -f ./node_modules/ ./gh-pages/
- name: Upload Artifacts
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: gh-pages
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
path: |
${{ github.workspace }}/gh-pages
!**/*.git
name: site
path: gh-pages

- name: no-jekyll
run: |
touch gh-pages/.nojekyll
- name: Deploy to gh-pages
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.GH_BOT_TOKEN }}
Expand All @@ -66,4 +94,4 @@ jobs:
directory: gh-pages
branch: gh-pages
force: false
message: automatic-update-${{ steps.date.outputs.date }}
message: "Deploy site from ${{ github.sha }}"
20 changes: 20 additions & 0 deletions .github/workflows/rss-monitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Monitor RSS feed

on:
schedule:
- cron: "0 * * * *" # hourly

jobs:
rss-monitor:
runs-on: ubuntu-latest
steps:
- name: RSS to issues
uses: git-for-windows/rss-to-issues@v0
with:
github-token: ${{ secrets.GH_BOT_TOKEN }}
feed: https://lizardbyte.github.io/feed.xml
character-limit: 0
dry-run: false
max-age: 48h
labels: blog
164 changes: 164 additions & 0 deletions .github/workflows/rss-notifier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
name: RSS Notifier

on:
issues:
types: [opened]

jobs:
authorize:
runs-on: ubuntu-latest
outputs:
authorized: ${{ steps.authorize.outputs.result }}
steps:
- name: Authorize
id: authorize
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_BOT_TOKEN }}
result-encoding: string
script: |
// get issue
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
// get author
const author = issue.data.user.login;
// check if author is LizardByte-bot
if (author === 'LizardByte-bot') {
console.log('Author is LizardByte-bot');
} else {
console.log('Author is not LizardByte-bot');
return 'false';
}
// check if label is blog
const labels = issue.data.labels.map(label => label.name);
if (labels.includes('blog')) {
console.log('Label is blog');
} else {
console.log('Label is not blog');
return 'false';
}
return 'true';
discord:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: "https://discord.com/channels/804382334370578482/804383203020374016"
runs-on: ubuntu-latest
steps:
- name: discord
uses: sarisia/actions-status-discord@v1
with:
avatar_url: ${{ secrets.ORG_LOGO_URL }}
color: 0x00ff00
nodetail: true
nofail: false
title: ${{ github.event.issue.title }}
url: ${{ github.event.issue.body }}
username: ${{ secrets.DISCORD_USERNAME }}
webhook: ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}

fb_group:
if: false && needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: "https://www.facebook.com/groups/lizardbyte"
runs-on: ubuntu-latest
steps:
- name: facebook-post-action
uses: ReenigneArcher/facebook-post-action@v1
with:
page_id: ${{ secrets.FACEBOOK_GROUP_ID }}
access_token: ${{ secrets.FACEBOOK_ACCESS_TOKEN }}
message: ${{ github.event.issue.title }}
url: ${{ github.event.issue.body }}

fb_page:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: "https://www.facebook.com/LizardByteDev"
runs-on: ubuntu-latest
steps:
- name: facebook-post-action
uses: ReenigneArcher/facebook-post-action@v1
with:
page_id: ${{ secrets.FACEBOOK_PAGE_ID }}
access_token: ${{ secrets.FACEBOOK_ACCESS_TOKEN }}
message: ${{ github.event.issue.title }}
url: ${{ github.event.issue.body }}

reddit:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: ${{ steps.post.outputs.postUrl }}
runs-on: ubuntu-latest
steps:
- name: reddit
id: post
uses: bluwy/release-for-reddit-action@v2
with:
username: ${{ secrets.REDDIT_USERNAME }}
password: ${{ secrets.REDDIT_PASSWORD }}
app-id: ${{ secrets.REDDIT_CLIENT_ID }}
app-secret: ${{ secrets.REDDIT_CLIENT_SECRET }}
subreddit: ${{ secrets.REDDIT_SUBREDDIT }}
title: ${{ github.event.issue.title }}
url: ${{ github.event.issue.body }}
flair-id: ${{ secrets.REDDIT_FLAIR_ID }} # https://www.reddit.com/r/<subreddit>>/api/link_flair.json

x:
if: needs.authorize.outputs.authorized == 'true'
needs: authorize
outputs:
post-url: "https://x.com/LizardByteDev"
runs-on: ubuntu-latest
steps:
- name: x
uses: nearform-actions/github-action-notify-twitter@v1
# alternative: noweh/[email protected]
with:
message: "${{ github.event.issue.title }}: ${{ github.event.issue.body }}"
twitter-app-key: ${{ secrets.X_APP_KEY }}
twitter-app-secret: ${{ secrets.X_APP_SECRET }}
twitter-access-token: ${{ secrets.X_ACCESS_TOKEN }}
twitter-access-token-secret: ${{ secrets.X_ACCESS_TOKEN_SECRET }}

close-issue:
if: always()
needs:
- authorize
- discord
- facebook_group
- facebook_page
- reddit
- x
runs-on: ubuntu-latest
steps:
- name: Close issue
env:
GH_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
run: |
comment="| Job | Status | Post URL |\n"
comment+="| --- | ------ | -------- |\n"
comment+="| Authorize | ${{ needs.authorize.result }} | |\n"
comment+="| Discord | ${{ needs.discord.result }} | ${{ needs.discord.outputs.post-url }} |\n"
# comment+="| Facebook Group | ${{ needs.fb_group.result }} | ${{ needs.fb_group.outputs.post-url }} |\n"
comment+="| Facebook Page | ${{ needs.fb_page.result }} | ${{ needs.fb_page.outputs.post-url }} |\n"
comment+="| Reddit | ${{ needs.reddit.result }} | ${{ needs.reddit.outputs.post-url }} |\n"
comment+="| X | ${{ needs.x.result }} | ${{ needs.x.outputs.post-url }} |\n"
close_reason="completed"
lock_reason="resolved"
gh issue close ${{ github.event.issue.number }} --comment "${comment}" --reason "${close_reason}"
gh issue lock ${{ github.event.issue.number }} --reason "${lock_reason}"
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
# ignore JetBrains project
.idea/

# ignore node modules
node_modules/
package-lock.json

# ignore duplicated dist folder for localization
dist/en
dist/es-ES
_site/
20 changes: 20 additions & 0 deletions .run/Dockerfile.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="containerName" value="LizardByte-site" />
<option name="portBindings">
<list>
<DockerPortBindingImpl>
<option name="containerPort" value="4000" />
<option name="hostPort" value="4000" />
</DockerPortBindingImpl>
</list>
</option>
<option name="commandLineOptions" value="--net=host" />
<option name="sourceFilePath" value="Dockerfile" />
</settings>
</deployment>
<method v="2" />
</configuration>
</component>
File renamed without changes.
13 changes: 13 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: 404 - Page not found
layout: default
permalink: /404.html
---

<div class="text-center">
<h1>Whoops, this page doesn't exist.</h1>
<h1>Move along. (404 error)</h1>
<br/>

<img src="{{ 'assets/img/404-southpark.jpg' | relative_url }}" alt="Not found" />
</div>
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app.lizardbyte.dev
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ruby:3.3-bookworm

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN <<_DEPS
#!/bin/bash
set -e

apt-get update -qq
apt-get install -y --no-install-recommends \
build-essential
apt-get clean
rm -rf /var/lib/apt/lists/*
_DEPS

WORKDIR /app

COPY . .

# Install the gems specified in the Gemfile
RUN <<_SETUP
#!/bin/bash
set -e

bundle install
_SETUP

# Expose the port that Jekyll will run on
EXPOSE 4000

# Command to build and serve the Jekyll site
CMD ["bundle", "exec", "jekyll", "serve", "--trace", "--config", "_config.yml,_config_local.yml"]
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'jekyll'
gem 'github-pages', group: :jekyll_plugins
Loading

0 comments on commit 6e9b4ec

Please sign in to comment.