Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuoqiu-Yingyi committed Nov 18, 2023
0 parents commit cf2b6e6
Show file tree
Hide file tree
Showing 25 changed files with 1,664 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# These are supported funding model platforms


# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
# github:

# Replace with a single Patreon username
# patreon:

# Replace with a single Open Collective username
# open_collective:

# Replace with a single Ko-fi username
ko_fi: zuoqiu

# Replace with a single Tidelift platform-name/package-name e.g., npm/babel
# tidelift:

# Replace with a single Community Bridge project-name e.g., cloud-foundry
# community_bridge:

# Replace with a single Liberapay username
# liberapay:

# Replace with a single IssueHunt username
# issuehunt:

# Replace with a single Otechie username
# otechie:

# Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
# lfx_crowdfunding:

# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom:
- https://afdian.net/a/zuoqiu
93 changes: 93 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 构建并部署 | Build and deploy

name: build

on:
workflow_dispatch:
push:
tags:
# REF https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- "v[0-9]+.[0-9]+.[0-9]+"

env:
PACKAGE_PATH: ./workspace/plugins/template

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Checkout
# REF https://github.com/marketplace/actions/checkout
- name: Checkout
uses: actions/checkout@v3
with:
## 将要拉取的仓库 | repository will to pull
repository: Zuoqiu-Yingyi/siyuan-packages-monorepo

# Install Node.js
# REF https://github.com/marketplace/actions/setup-node-js-environment
- name: Install Node.js
uses: actions/setup-node@v3
with:
## Node.js 版本号 | Node.js version
node-version: 20

## Node.js 源 | Node.js registry
registry-url: https://registry.npmjs.org

# Install pnpm
# REF https://github.com/marketplace/actions/setup-pnpm
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
## pnpm 版本号 | pnpm version
version: 8

## 是否安装 npm 包 | if install npm package?
run_install: false

# Get pnpm store directory
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
# Setup pnpm cache
# REF https://github.com/marketplace/actions/cache
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
# Install dependencies
- name: Install dependencies
run: |
cd $GITHUB_WORKSPACE
cd ./workspace
pnpm install
# Build package
- name: Build package
run: |
cd $GITHUB_WORKSPACE
cd $PACKAGE_PATH
pnpm build
# Deploy to publish branch
# REF https://github.com/marketplace/actions/github-pages
- name: Deploy to publish branch
if: success()
uses: crazy-max/ghaction-github-pages@v3
with:
## 构建产物目录 | directory of build artifacts
build_dir: ${{ env.PACKAGE_PATH }}/dist

## 提交到目标分支
target_branch: publish
env:
GITHUB_TOKEN: ${{ secrets.PAT_ACTIONS }}
81 changes: 81 additions & 0 deletions .github/workflows/release-distribution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 发行构建产物 | Release the distribution

name: release-distribution

on:
workflow_dispatch:
# REF https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run
workflow_run:
workflows:
- build
types:
- completed
push:
branches:
- publish

permissions:
contents: write

jobs:
release-distribution:
runs-on: ubuntu-latest
steps:
# Checkout
# REF https://github.com/marketplace/actions/checkout
- name: Checkout
uses: actions/checkout@v3
with:
ref: publish

# Package
- name: Package
run: |
git archive -o ./package.zip HEAD
# Get latest release
# REF https://github.com/marketplace/actions/get-latest-release
- name: Get latest release
uses: pozetroninc/github-action-get-latest-release@v0.7.0
id: latest-release
with:
## 仓库所有者/仓库名 | owner/name
repository: ${{ github.repository }}

## 排除的发行类型 | Excluded types of release
# excludes: prerelease, draft
excludes: draft

# Get timestamp
# REF https://github.com/marketplace/actions/get-timestamp-action
- name: Get timestamp
uses: nanzm/get-time-action@v1.1
id: timestamp
with:
## 时区 | time zone
timeZone: 8

## 时间戳格式 | timestamp format
format: "YYYYMMDDHHmmss"

# Release distribution
# REF https://github.com/marketplace/actions/gh-release
- name: Release distribution
uses: softprops/action-gh-release@v1
with:
## 发行描述 | description of release
body: ${{ steps.latest-release.outputs.description }}

## 是否为预发行 | is prelease?
prerelease: true

## 标签名称 | tag name
# REF https://semver.org/
tag_name: ${{ steps.latest-release.outputs.release }}+${{ steps.timestamp.outputs.time }}

## 标签关联的提交/分支 | The commit/branch associated with the tag
target_commitish: publish

## 附件列表 | attachment list
files: |
package.zip
112 changes: 112 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 发行源码 | Release the source code

name: release-please

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

env:
PACKAGE_NAME: template
PACKAGE_VERSION: 0.0.0

jobs:
release-please:
runs-on: ubuntu-latest
steps:
# Create release
# REF https://github.com/marketplace/actions/release-please-action
- name: Create release
uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: ${{ env.PACKAGE_NAME }}
release-as: ${{ env.PACKAGE_VERSION }}

## A GitHub secret token, the action defaults to using the special secrets.GITHUB_TOKEN
## REF https://github.com/marketplace/actions/release-please-action#github-credentials
token: ${{ secrets.PAT_ACTIONS }}

## branch to open pull release PR against (detected by default)
default-branch: main

## Should breaking changes before 1.0.0 produce minor bumps? Default false
bump-minor-pre-major: false

## Should feat changes before 1.0.0 produce patch bumps instead of minor bumps? Default false
bump-patch-for-minor-pre-major: false

## If set, create releases that are pre-major or pre-release version marked as pre-release on GitHub. Defaults false
prerelease: true

## header used within the release PR body, defaults to using :robot: I have created a release *beep* *boop*
pull-request-header: ":robot: A new release will be created"

## A JSON formatted String containing to override the outputted changelog sections
changelog-types: |-
[
{
"type": "build",
"section": "Build System",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous",
"hidden": false
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": false
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "refactor",
"section": "Code Refactoring",
"hidden": false
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "style",
"section": "Styles",
"hidden": false
},
{
"type": "test",
"section": "Tests",
"hidden": false
},
{
"type": "",
"section": "Other Changes",
"hidden": false
}
]
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Loading

0 comments on commit cf2b6e6

Please sign in to comment.