Try adding docs
This commit is contained in:
parent
15c0a1ccc0
commit
04e1d9eb91
10 changed files with 144 additions and 74 deletions
17
.forgejo/workflows/docs.yml
Normal file
17
.forgejo/workflows/docs.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: selfhosted
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bundle install
|
||||||
|
- name: Build documentation
|
||||||
|
run: bundle exec ruby docs/build.rb
|
||||||
|
- name: Publish site
|
||||||
|
run: cp -rfv _build/* /srv/docs/phlexite/
|
46
.forgejo/workflows/gem-push.yml
Normal file
46
.forgejo/workflows/gem-push.yml
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Ruby Gem
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["*"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build + Publish
|
||||||
|
runs-on: docs
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Ruby 3.3
|
||||||
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
||||||
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
||||||
|
# uses: ruby/setup-ruby@v1
|
||||||
|
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
||||||
|
with:
|
||||||
|
ruby-version: 3.3.x
|
||||||
|
|
||||||
|
- name: Publish to GPR
|
||||||
|
run: |
|
||||||
|
mkdir -p $HOME/.gem
|
||||||
|
touch $HOME/.gem/credentials
|
||||||
|
chmod 0600 $HOME/.gem/credentials
|
||||||
|
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
||||||
|
gem build *.gemspec
|
||||||
|
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
||||||
|
env:
|
||||||
|
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
||||||
|
OWNER: ${{ github.repository_owner }}
|
||||||
|
|
||||||
|
- name: Publish to RubyGems
|
||||||
|
run: |
|
||||||
|
mkdir -p $HOME/.gem
|
||||||
|
touch $HOME/.gem/credentials
|
||||||
|
chmod 0600 $HOME/.gem/credentials
|
||||||
|
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
||||||
|
gem build *.gemspec
|
||||||
|
gem push *.gem
|
||||||
|
env:
|
||||||
|
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
27
.forgejo/workflows/main.yml
Normal file
27
.forgejo/workflows/main.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: Ruby
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: docker
|
||||||
|
name: Ruby ${{ matrix.ruby }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
ruby:
|
||||||
|
- "3.3.5"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: ${{ matrix.ruby }}
|
||||||
|
bundler-cache: true
|
||||||
|
- name: Run the default task
|
||||||
|
run: bundle exec rake
|
46
.github/workflows/gem-push.yml
vendored
46
.github/workflows/gem-push.yml
vendored
|
@ -1,46 +0,0 @@
|
||||||
name: Ruby Gem
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build + Publish
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Set up Ruby 3.3
|
|
||||||
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
||||||
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
||||||
# uses: ruby/setup-ruby@v1
|
|
||||||
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
|
||||||
with:
|
|
||||||
ruby-version: 3.3.x
|
|
||||||
|
|
||||||
- name: Publish to GPR
|
|
||||||
run: |
|
|
||||||
mkdir -p $HOME/.gem
|
|
||||||
touch $HOME/.gem/credentials
|
|
||||||
chmod 0600 $HOME/.gem/credentials
|
|
||||||
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
||||||
gem build *.gemspec
|
|
||||||
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
|
||||||
env:
|
|
||||||
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
|
||||||
OWNER: ${{ github.repository_owner }}
|
|
||||||
|
|
||||||
- name: Publish to RubyGems
|
|
||||||
run: |
|
|
||||||
mkdir -p $HOME/.gem
|
|
||||||
touch $HOME/.gem/credentials
|
|
||||||
chmod 0600 $HOME/.gem/credentials
|
|
||||||
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
||||||
gem build *.gemspec
|
|
||||||
gem push *.gem
|
|
||||||
env:
|
|
||||||
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
|
27
.github/workflows/main.yml
vendored
27
.github/workflows/main.yml
vendored
|
@ -1,27 +0,0 @@
|
||||||
name: Ruby
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Ruby ${{ matrix.ruby }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
ruby:
|
|
||||||
- '3.3.5'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Set up Ruby
|
|
||||||
uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
ruby-version: ${{ matrix.ruby }}
|
|
||||||
bundler-cache: true
|
|
||||||
- name: Run the default task
|
|
||||||
run: bundle exec rake
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@
|
||||||
/pkg/
|
/pkg/
|
||||||
/spec/reports/
|
/spec/reports/
|
||||||
/tmp/
|
/tmp/
|
||||||
|
_build/
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -11,6 +11,6 @@ gem "minitest", "~> 5.16"
|
||||||
|
|
||||||
gem "standard", "~> 1.3"
|
gem "standard", "~> 1.3"
|
||||||
|
|
||||||
gem "phlex", "~> 1.11"
|
gem "phlex", "~> 2.3"
|
||||||
|
|
||||||
gem "steep", "~> 1.7", group: :development
|
gem "steep", "~> 1.7", group: :development
|
||||||
|
|
13
docs/build.rb
Normal file
13
docs/build.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
require_relative '../lib/phlexite'
|
||||||
|
require 'phlex'
|
||||||
|
|
||||||
|
module Phlexite
|
||||||
|
module Docs end
|
||||||
|
end
|
||||||
|
|
||||||
|
require_relative 'pages/layout'
|
||||||
|
require_relative 'pages/index'
|
||||||
|
|
||||||
|
Phlexite::Site.new { |s|
|
||||||
|
s.page 'index.html', Phlexite::Docs::Pages::Index.new
|
||||||
|
}
|
10
docs/pages/index.rb
Normal file
10
docs/pages/index.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module Phlexite::Docs::Pages
|
||||||
|
class Index < ::Phlex::HTML
|
||||||
|
def view_template
|
||||||
|
render Layout.new {
|
||||||
|
h1 { 'Phlexite' }
|
||||||
|
p { 'Phlexite is a simple static site generator for Ruby.' }
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
29
docs/pages/layout.rb
Normal file
29
docs/pages/layout.rb
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
module Phlexite::Docs::Pages
|
||||||
|
class Layout < ::Phlex::HTML
|
||||||
|
def view_template
|
||||||
|
doctype
|
||||||
|
html {
|
||||||
|
head {
|
||||||
|
meta charset: 'utf-8'
|
||||||
|
|
||||||
|
meta name: 'viewport', content: 'width=device-width, initial-scale=1.0'
|
||||||
|
title { "Phlexite" }
|
||||||
|
|
||||||
|
link rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css'
|
||||||
|
}
|
||||||
|
body(style: "padding: 0; margin: 0; display: flex; flex-direction: row; height: 100vh; width: 100vw;") {
|
||||||
|
aside(style: 'padding: 30px; min-width: 15%; border-right: 1px solid #6F7887;') {
|
||||||
|
nav {
|
||||||
|
ul {
|
||||||
|
li { a(href: '/') { 'Home' } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div(class: 'container', style: 'padding: 20px') {
|
||||||
|
yield
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue