Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
VirgilClyne committed Nov 18, 2024
1 parent cbec8ca commit 3f893db
Show file tree
Hide file tree
Showing 49 changed files with 12,331 additions and 117 deletions.
14 changes: 14 additions & 0 deletions .github/RELEASE-TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### 🆕 New Features
* none

### 🛠️ Bug Fixes
* none

### 🔣 Dependencies
* none

### ‼️ Breaking Changes
* none

### 🔄 Other Changes
* none
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on:
workflow_call:
workflow_dispatch:

permissions:
actions: read
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@main
with:
node-version: 'latest'
cache: 'npm'
- name: Install dependencies
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Update local package.json version from release tag
if: github.ref_type == 'tag'
uses: BellCubeDev/update-package-version-by-release-tag@v2
with:
version: ${{ github.ref_name }}
keep-v: "false" # If set to "true", will not remove any 'v' prefix from the version number.
ignore-semver-check: "false" # If set to "true", will not check if the version number is a valid semver version.
- name: Build scripts
run: npm run build
- name: Generate modules
run: npm run build:args
- name: Upload artifact
uses: actions/upload-artifact@master
with:
name: artifact
path: |
CHANGELOG.md
rulesets
dist
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- dev

permissions:
actions: read
contents: read

jobs:
debug:
uses: ./.github/workflows/dev.yml
secrets: inherit
deploy:
needs: debug
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@master
with:
name: artifact
- name: Deploy Response
uses: exuanbo/actions-deploy-gist@main
with:
token: ${{ secrets.GIST_TOKEN }}
gist_id: 862db28df04be7523476d10b61b128f2
gist_description: " iRingo: 🌤 Weather β"
file_path: dist/response.bundle.js
38 changes: 38 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Dev
on:
workflow_call:
workflow_dispatch:

permissions:
actions: read
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_TOKEN }}
ref: dev
- name: Set up Node.js
uses: actions/setup-node@main
with:
node-version: 'latest'
cache: 'npm'
- name: Install dependencies
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
- name: Build
run: npm run build:dev
- name: Upload artifact
uses: actions/upload-artifact@master
with:
name: artifact
path: |
CHANGELOG.md
rulesets
dist
32 changes: 32 additions & 0 deletions .github/workflows/draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Draft
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- main

permissions:
actions: read
contents: write

jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
draft:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@master
with:
name: artifact
- name: Publish Draft
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
token: ${{ secrets.GITHUB_TOKEN }}
files: |
rulesets/*
dist/*
draft: true
33 changes: 33 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pre-Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+

permissions:
actions: read
contents: write

jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
pre-release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@master
with:
name: artifact
- name: Publish Pre-Release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
token: ${{ secrets.GITHUB_TOKEN }}
files: |
rulesets/*
dist/*
prerelease: true
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- v[0-9]+.[0-9]+.[0-9]+

permissions:
actions: read
contents: write

jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@master
with:
name: artifact
- name: Publish Release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
token: ${{ secrets.GITHUB_TOKEN }}
files: |
rulesets/*
dist/*
make_latest: "true"
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/proto"]
path = src/proto
url = https://github.com/NSRingo/proto.git
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=https://registry.npmjs.org/
@nsnanocat:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### 🆕 New Features
* `空气质量`增加`与昨日同时间对比`功能
* 为实现此功能,现在默认替换来自`和风天气``空气质量`数据

### 🔄 Other Changes
* `util``submodule` 更改为 `package`
138 changes: 138 additions & 0 deletions arguments-builder.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import { defineConfig } from "@iringo/arguments-builder";

export default defineConfig({
output: {
surge: {
path: "./dist/iRingo.Weather.sgmodule",
transformEgern: {
enable: true,
path: "./dist/iRingo.Weather.yaml",
},
},
loon: {
path: "./dist/iRingo.Weather.plugin",
},
customItems: [
{
path: "./dist/iRingo.Weather.snippet",
template: "./template/quantumultx.handlebars",
},
{
path: "./dist/iRingo.Weather.stoverride",
template: "./template/stash.handlebars",
},
{
path: "./dist/iRingo.Weather.srmodule",
template: "./template/shadowrocket.handlebars",
},
],
dts: {
isExported: true,
path: "./src/types.d.ts",
},
boxjsSettings: {
path: "./template/boxjs.settings.json",
scope: "@iRingo.Weather.Settings",
},
},
args: [
{
key: "NextHour.Provider",
name: "[未来一小时降水强度] 数据源",
defaultValue: "ColorfulClouds",
type: "string",
options: [
{ key: "WeatherKit", label: "WeatherKit (不进行替换)" },
{ key: "ColorfulClouds", label: "彩云天气" },
{ key: "QWeather", label: "和风天气" },
],
description: "始终会使用选定的数据源,填补无降水监测地区的数据。",
},
{
key: "AQI.Provider",
name: "[空气质量] 数据源",
defaultValue: "ColorfulClouds",
type: "string",
options: [
{ key: "WeatherKit", label: "WeatherKit (不进行替换)" },
{ key: "ColorfulClouds", label: "彩云天气" },
{ key: "QWeather", label: "和风天气" },
{ key: "WAQI", label: "The World Air Quality Project" },
],
description: "始终会使用选定的数据源,填补无空气质量监测地区的数据。",
},
{
key: "AQI.ReplaceProviders",
name: "[空气质量] 需要替换的供应商",
defaultValue: ["QWeather"],
type: "array",
description: "选中的空气质量数据源会被替换。",
options: [
{ key: "QWeather", label: "和风天气" },
{ key: "BreezoMeter", label: "BreezoMeter" },
{ key: "TWC", label: "The Weather Channel" },
],
},
{
key: "AQI.Local.Scale",
type: "string",
name: "[空气质量] 本地替换算法",
description: "本地替换时使用的算法",
defaultValue: "WAQI_InstantCast",
options: [
{ key: "NONE", label: "None (不进行替换)" },
{ key: "WAQI_InstantCast", label: "WAQI InstantCast" },
],
},
{
key: "AQI.Local.ReplaceScales",
type: "array",
name: "[空气质量] 需要修改的标准",
description: "选中的空气质量标准会被替换。请注意各国监测的污染物种类可能有所不同,转换算法或API未必适合当地。",
defaultValue: ["HJ6332012"],
options: [{ key: "HJ6332012", label: "中国 (HJ 633—2012)" }],
},
{
key: "AQI.Local.ConvertUnits",
name: "[空气质量] 转换污染物计量单位",
defaultValue: false,
type: "boolean",
description: "将污染物数据替换为转换单位后的数据,方便对照转换后的标准。(不推荐。不同单位互转可能会损失精度,导致数值偏大)",
},
{
key: "API.ColorfulClouds.Token",
name: "[API] 彩云天气令牌",
defaultValue: "",
type: "string",
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
description: "彩云天气 API 令牌",
},
{
key: "API.QWeather.Host",
name: "[API] 和风天气主机",
defaultValue: "devapi.qweather.com",
type: "string",
description: "和风天气 API 使用的主机名",
options: [
{ key: "devapi.qweather.com", label: "免费订阅 (devapi.qweather.com)" },
{ key: "api.qweather.com", label: "付费订阅 (api.qweather.com)" },
],
},
{
key: "API.QWeather.Token",
name: "[API] 和风天气令牌",
defaultValue: "",
type: "string",
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
description: "和风天气 API 令牌",
},
{
key: "API.WAQI.Token",
name: "[API] WAQI 令牌",
defaultValue: "",
type: "string",
placeholder: "123456789123456789abcdefghijklmnopqrstuv",
description: "WAQI API 令牌,填写此字段将自动使用WAQI高级API",
},
],
});
Loading

0 comments on commit 3f893db

Please sign in to comment.