Skip to content

Commit

Permalink
build: use github pages for staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Octobug committed Nov 22, 2023
1 parent b555700 commit 86804f9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: GitHub Pages
name: Staging

on:
push:
branches: [main]
branches: [staging]

workflow_dispatch:

env:
BASE_URL: ${{ vars.BASE_URL }}

permissions:
contents: read
pages: write
Expand Down Expand Up @@ -43,7 +46,7 @@ jobs:

deploy:
environment:
name: production
name: staging
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
Expand Down
7 changes: 6 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { env } from "process";
import * as path from "path";
import { defineConfigWithTheme } from "vitepress";
import type { ThemeConfig } from "./theme/types/theme-config";
import themeConfig from "./config.theme";

const baseURL = env.BASE_URL || undefined;

export default defineConfigWithTheme<ThemeConfig>({
title: "WhaleVocal",
description: "Octobug's blog.",
base: baseURL,
cleanUrls: true,
lastUpdated: true,
head: [
Expand All @@ -13,7 +18,7 @@ export default defineConfigWithTheme<ThemeConfig>({
{
rel: "icon",
type: "image/png",
href: "/avatar.png",
href: path.join(baseURL || "/", "/avatar.png")
},
],
[
Expand Down
4 changes: 3 additions & 1 deletion .vitepress/theme/posts.data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// https://vitepress.dev/guide/data-loading
import * as path from "path";
import { env } from "process";
import { createContentLoader, ContentData } from "vitepress";
import readingTime from "reading-time";
import extendedConfig from "../config.theme";
Expand All @@ -20,7 +22,7 @@ export default createContentLoader(extendedConfig.mdfilePatterns, {
p.frontmatter.title = extractTile(p.src || "");
p.frontmatter.datetime = new Date(p.frontmatter.date);
p.frontmatter.readingTime = readingTime(p.src || "").text;
p.url = p.url.replace("/README", "");
p.url = path.join(env.BASE_URL || "/", p.url.replace("/README", ""));
return p;
}).sort((a, b) => {
return b.frontmatter.datetime - a.frontmatter.datetime;
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# 🐳 WhaleVocal

[![Netlify Status](https://api.netlify.com/api/v1/badges/23e0b8dc-df98-491d-9885-d4229baa1ccb/deploy-status)](https://app.netlify.com/sites/octobug-blog/deploys)
[![Badge: GitHub](https://github.com/Octobug/blog/actions/workflows/deploy.yml/badge.svg)](https://github.com/Octobug/blog/actions)

Thoughts on everything: [blog.octobug.site](https://blog.octobug.site/).
- <https://blog.octobug.site> (hosted on [Netlify](https://netlify.com/))

## The Theme

Expand All @@ -11,6 +12,24 @@ This blog is powered by [VitePress](https://vitepress.dev/) with a customized th
- [airene/vitepress-blog-pure](https://github.com/airene/vitepress-blog-pure)
- [clark-cui/vitepress-blog-zaun](https://github.com/clark-cui/vitepress-blog-zaun)

### Features

- [x] Home
- [x] Profile Card
- [x] Paged Post List
- [ ] Single Post
- [x] Publication Date
- [x] Location
- [x] Reading Time
- [x] Prev/Next (without the built-in global sidebar)
- [ ] Comments with Giscus
- [ ] Posts (Archives)
- [ ] Tags
- [ ] Sorts (Categories)
- [ ] Others
- [ ] Visions (for special pages)
- [ ] Google Analytics

## Contribution

This project is not going to be made an out-of-the-box blog theme. It's a very personal project, but any helps and advice are welcome.
Expand Down

0 comments on commit 86804f9

Please sign in to comment.