Skip to content

Commit

Permalink
release: 1.0.0
Browse files Browse the repository at this point in the history
Merge pull request #130 from transky-book/main
  • Loading branch information
Cryolitia authored Sep 27, 2024
2 parents aa7943f + 2bd6590 commit e777594
Show file tree
Hide file tree
Showing 781 changed files with 16,521 additions and 7,730 deletions.
3 changes: 3 additions & 0 deletions .autocorrectrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# yaml-language-server: $schema=https://huacnlee.github.io/autocorrect/schema.json
textRules:
哆啦A梦: 0
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.md linguist-vendored=false
*.md linguist-generated=false
*.md linguist-documentation=false
*.md linguist-detectable=true
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.github @Cryolitia
43 changes: 43 additions & 0 deletions .github/workflows/build-ebook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build ebook

on:
workflow_dispatch:
workflow_call:
pull_request:

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

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main

- name: Print flake metadata
run: nix flake metadata --accept-flake-config

- name: Build
run: |
sed -e "s/BUILD_TIME/$(TZ=Asia/Shanghai date -Isecond)/" -e "s/COMMIT_SHA/${{ github.sha }}/" -i src/about.md
NIXPKGS_ALLOW_UNFREE=1 nix build .# --impure --accept-flake-config
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ebook
path: |
result/share/transky-book/book/epub/药娘的天空.epub
result/share/transky-book/book/mobi/药娘的天空.mobi
result/share/transky-book/book/typst-pdf/药娘的天空.pdf
44 changes: 44 additions & 0 deletions .github/workflows/build-web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build website

on:
workflow_dispatch:
workflow_call:
pull_request:

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: current

- name: Build
env:
NODE_OPTIONS: --max_old_space_size=4096
run: |
sed -e "s/BUILD_TIME/$(TZ=Asia/Shanghai date -Isecond)/" -e "s/COMMIT_SHA/${{ github.sha }}/" -i src/about.md
pnpm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: website
path: src/.vitepress/dist/
45 changes: 0 additions & 45 deletions .github/workflows/build.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint

on:
pull_request:

permissions:
pull-requests: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: AutoCorrect
uses: huacnlee/autocorrect-action@main

- name: Report ReviewDog
if: failure()
uses: huacnlee/autocorrect-action@main
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
reviewdog: true
43 changes: 43 additions & 0 deletions .github/workflows/publish-cloudflare.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish website to cloudflare

on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- ".github/workflows/build-web.yaml"
- ".github/workflows/publish-cloudflare.yaml"
- ".vitepress/**"
- "src/**"
- "package.json"
- "pnpm-lock.yaml"

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

jobs:
build:
uses: ./.github/workflows/build-web.yaml

publish:
needs: build
runs-on: ubuntu-latest
environment: cloudflare-pages
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: website
path: website

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }}
projectName: transky-book
directory: website
wranglerVersion: 3
75 changes: 75 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Publish ebook to release

on:
workflow_dispatch:
push:
branches:
- "main"
- "stable"
paths:
- ".github/workflows/build-ebook.yaml"
- ".github/workflows/publish-release.yaml"
- ".releaserc"
- "src/**"
- "theme/**"
- "book.toml"
- "package.json"
- "pnpm-lock.yaml"
- "flake.nix"
- "flake.lock"

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

permissions:
contents: write
id-token: write

jobs:
build:
uses: ./.github/workflows/build-ebook.yaml

publish:
permissions:
contents: write
needs: build
if: ${{ !(github.event_name == 'push' && contains(github.event.head_commit.message, '[skip release]')) }}
runs-on: ubuntu-latest
environment: flake
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.TRIGGER_APP_ID }}
private-key: ${{ secrets.TRIGGER_APP_SECRET }}

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: latest
run_install: true

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: current

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ebook
path: ebook

- name: Release ebook
env:
GITHUB_TOKEN: ${{ github.token }}
run: pnpm exec semantic-release
55 changes: 55 additions & 0 deletions .github/workflows/update-flake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Update flake"

on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- ".github/workflows/update-flake.yaml"
schedule:
- cron: '31 2 * * 5'

permissions:
contents: write

jobs:
sync-flake:
runs-on: ubuntu-latest
environment: flake
steps:
- uses: DeterminateSystems/nix-installer-action@main

- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.TRIGGER_APP_ID }}
private-key: ${{ secrets.TRIGGER_APP_SECRET }}

- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
token: ${{ steps.generate-token.outputs.token }}

- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git show -s
- name: Update flake
run: |
set +e
nix flake update --accept-flake-config
nix flake info --accept-flake-config
# suppress inactive repo update weekly
git log --pretty=format:"%s" -1 HEAD | grep "dep: flake update" && exit 0
git add .
git status
git commit -m "dep: flake update $(date +'%Y-%m-%dT%H:%M:%S')" || exit 0
git push
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
book
src/.vitepress/cache
src/.vitepress/dist
src/.vitepress/.temp
node_modules
result
src/.vitepress/components.d.ts
Loading

0 comments on commit e777594

Please sign in to comment.