Skip to content

Commit

Permalink
feat: 导入工具第一个版本
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed May 17, 2023
1 parent 4ad0fef commit 1fc739b
Show file tree
Hide file tree
Showing 14 changed files with 796 additions and 44 deletions.
39 changes: 39 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: 2
updates:
# Fetch and update latest `npm` packages
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "00:00"
open-pull-requests-limit: 10
reviewers:
- terwer
assignees:
- terwer
commit-message:
prefix: fix
prefix-development: chore
include: scope
labels:
- "npm dependencies"
- "npm"

# Fetch and update latest `github-actions` pkgs
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "00:00"
open-pull-requests-limit: 10
reviewers:
- terwer
assignees:
- terwer
commit-message:
prefix: fix
prefix-development: chore
include: scope
labels:
- "github actions"
- "ci"
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches:
- main
- dev

jobs:
build:
name: Build
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: pnpm/[email protected]
with:
version: 8

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Package
# 上面的 Build 已经构建过了,这里可以忽略 Build ,避免重复运行
run: pnpm package
102 changes: 102 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
on:
push:
branches:
- main

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
# Create release
- name: Create release
uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: release-please-action
## 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: false
## 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":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"refactor","section":"Code Refactoring","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"perf","section":"Performance Improvements","hidden":false}]'

# Checkout
- name: Checkout
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v3

# Install Node.js
- name: Install Node.js
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

# Install pnpm
- name: Install pnpm
if: ${{ steps.release.outputs.release_created }}
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false

# Get pnpm store directory
- name: Get pnpm store directory
if: ${{ steps.release.outputs.release_created }}
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
# Setup pnpm cache
- name: Setup pnpm cache
if: ${{ steps.release.outputs.release_created }}
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
if: ${{ steps.release.outputs.release_created }}
run: pnpm install

# Prepare new version
# https://github.com/google-github-actions/release-please-action#outputs
- name: Prepare new version
if: ${{ steps.release.outputs.release_created }}
run: |
pnpm prepareRelease
# Build for production
- name: Build for production
if: ${{ steps.release.outputs.release_created }}
run: pnpm build

# Archive package
- name: Build for production
if: ${{ steps.release.outputs.release_created }}
run: pnpm package

# Upload package to release
# https://github.com/philips-labs/terraform-aws-github-runner/blob/main/.github/workflows/release.yml#L46
- name: Upload package.zip to the release
if: ${{ steps.release.outputs.releases_created }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
for f in $(find ./build -name '*.zip'); do
gh release upload ${{ steps.release.outputs.tag_name }} $f
done
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.DS_Store
node_modules
dist
dist
build
Empty file added CHANGELOG.md
Empty file.
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@
"dev": "vite build --watch",
"build": "vite build",
"start": "vite preview",
"test": "vitest --watch"
"test": "vitest --watch",
"syncVersion": "ts-node-esm --experimental-specifier-resolution=node tools/syncVersion.ts",
"parseChangelog": "ts-node-esm --experimental-specifier-resolution=node tools/changelogParser.ts",
"prepareRelease": "pnpm syncVersion && pnpm parseChangelog",
"package": "ts-node-esm --experimental-specifier-resolution=node tools/packageApp.ts"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.0.3",
"@terwer/changelog-parser": "^1.1.0",
"@terwer/eslint-config-custom": "^1.2.0",
"@terwer/vite-config-custom": "^0.5.0",
"@terwer/vite-config-custom": "^0.6.0",
"@tsconfig/svelte": "^4.0.1",
"archiver": "^5.3.1",
"siyuan": "^0.7.1",
"stylus": "^0.59.0",
"svelte": "^3.57.0"
"svelte": "^3.57.0",
"ts-node": "^10.9.1"
}
}
Loading

0 comments on commit 1fc739b

Please sign in to comment.