21 Commits

Author SHA1 Message Date
b321d0e415 refactor: 移除 docker-build-push 工作流中的测试 vars 步骤 2024-10-15 23:07:09 +08:00
a436649d0b feat: 更新 docker-build-push 工作流中的测试步骤以使用 vars 代替 secrets 2024-10-15 23:03:48 +08:00
8c48919d2b feat: 在 docker-build-push 工作流中为测试步骤指定 bash shell 2024-10-15 23:00:32 +08:00
2d9eca2894 feat: 在 docker-build-push 工作流中添加测试 secrets 的步骤 2024-10-15 22:58:19 +08:00
64d6ac9814 feat: 在 renovate.json 中添加 packageRules 以设置最小发布年龄 2024-10-14 10:59:23 +08:00
c7b53ebd10 refactor: 移除 GitHub Actions 工作流中的 tree 命令 2024-10-14 10:57:18 +08:00
f7e317688b feat: 在 GitHub Actions 工作流中添加 tree 命令以列出 hostedtoolcache 目录结构 2024-10-14 10:54:05 +08:00
ea235bf784 refactor: 简化 GitHub Actions 工作流中的调试步骤 2024-10-14 10:53:45 +08:00
f49701ce53 feat: 在 GitHub Actions 工作流中添加调试步骤,列出 hostedtoolcache 目录内容 2024-10-14 10:52:10 +08:00
92a737252b feat: 更新 GitHub Actions 工作流,添加多平台和多 Node 版本支持 2024-10-14 10:48:27 +08:00
13dd5d7bdb 测试 actions/setup-node@v4 2024-10-14 09:32:12 +08:00
e7fd5cc26b Update action.yml 2024-10-13 17:21:42 +08:00
d3c52b5b83 Update action.yml 2024-10-13 17:20:06 +08:00
52dbb4ce12 feat: 添加 .gitignore 文件,忽略 node_modules 目录;更新 package.json 以添加 bun 依赖 2024-10-12 18:39:42 +08:00
c7fa63d9b5 feat: 更新脚本注释,增加对 pnpm 和 node 版本的判断逻辑 2024-10-12 18:35:41 +08:00
de21dcf6bd fix: 修正变量名拼写错误,将 setup-pnpm 更改为 setupPnpm 2024-10-12 18:25:14 +08:00
e57f1a275b feat: 优化 Node 环境设置,改进 pnpm 检查逻辑并添加输出信息 2024-10-12 18:23:52 +08:00
f835a63583 feat: 简化输出信息,减少分隔符的使用 2024-10-12 18:12:10 +08:00
6cf720250a feat: 简化 Docker 构建推送工作流,移除操作系统矩阵并强制使用 Ubuntu 2024-10-12 17:51:57 +08:00
76e102f6a5 feat: 更新工作流以使用最新的 macOS 版本 2024-10-12 17:49:34 +08:00
2dda4ee55a feat: 更新 Docker 构建推送工作流以根据操作系统和发布状态动态决定构建推送 2024-10-12 17:47:12 +08:00
7 changed files with 143 additions and 32 deletions

View File

@ -12,11 +12,11 @@ env:
jobs:
job:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15] # https://docs.github.com/zh/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#用于公共存储库的-github-托管的标准运行器
runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, macos-latest] # https://docs.github.com/zh/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#用于公共存储库的-github-托管的标准运行器
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: yanhao98/semantic-release-action@main

View File

@ -11,7 +11,7 @@ env:
TZ: Asia/Shanghai
jobs:
job:
job-1:
strategy:
fail-fast: false
matrix:
@ -35,7 +35,11 @@ jobs:
node -v;
pnpm node -v;
job-2: # 测试 .npmrc 文件没有 use-node-version 字段
_npmrc_no_use_node_version:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
@ -55,3 +59,16 @@ jobs:
which pnpm;
node -v;
pnpm node -v;
actions_setup_node_v4:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22, lts/*]
steps:
- name: "node-version: ${{ matrix.node-version }}"
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: ls -lha /opt/hostedtoolcache
- run: ls -lha /opt/hostedtoolcache/node/

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -1,3 +1,6 @@
{
"packageManager": "pnpm@9.11.0"
"packageManager": "pnpm@9.11.0",
"dependencies": {
"bun": "^1.1.30"
}
}

91
pnpm-lock.yaml generated
View File

@ -6,4 +6,93 @@ settings:
importers:
.: {}
.:
dependencies:
bun:
specifier: ^1.1.30
version: 1.1.30
packages:
'@oven/bun-darwin-aarch64@1.1.30':
resolution: {integrity: sha512-D07QioP+QXlouvIqQIS+7r2zq4lTNd6he79rhKsRQRZGFf9i3NPu87zspUpCaFEu//DZ35DYTt+5anQpAzpoxA==}
cpu: [arm64]
os: [darwin]
'@oven/bun-darwin-x64-baseline@1.1.30':
resolution: {integrity: sha512-1kFUCxHx7WuEbLDmqm0m2UKBd3S4Ln6qKQ4gxU4umMLFkmvDJn6PszDruFInxGKFLoTAmbXNYNVWkkG/ekt/Lg==}
cpu: [x64]
os: [darwin]
'@oven/bun-darwin-x64@1.1.30':
resolution: {integrity: sha512-xZ4gTehS6QwN6bsJfDycCNneKoUMaFUQhQg24bJzXS4JPDxeKg1W7PS5AE+U9apz5Dx6//+D4RwVpAPG2LXt0w==}
cpu: [x64]
os: [darwin]
'@oven/bun-linux-aarch64@1.1.30':
resolution: {integrity: sha512-SfHHLlph6fptDXyyChcUkeDbEZr2ww1p2BucV6OrvzwTOPi8pVmXA4360YT8ggR/3AHPp4GO36VaD+FU2Ocbxw==}
cpu: [arm64]
os: [linux]
'@oven/bun-linux-x64-baseline@1.1.30':
resolution: {integrity: sha512-/b/VuNOaAYmsVk9MvfwKcCYARJPUg78hebxNyD5DSajAf3dqtUSnf7QYcq/3mxWH++N+gM7uRTrGksGS63+ZUw==}
cpu: [x64]
os: [linux]
'@oven/bun-linux-x64@1.1.30':
resolution: {integrity: sha512-1mC39jQSaECytEKAZdCZmv3ZreMsp7aoxnBwmJtVd2Z7urnw17PKi4dKkZd/R+AubsNYtXtW4jeM8SEa5sUJRw==}
cpu: [x64]
os: [linux]
'@oven/bun-windows-x64-baseline@1.1.30':
resolution: {integrity: sha512-ERQ4/ogzbFvHjpyHcnruc8bnryvDvUoiWi6vczfQ4M/idJc+Kg5VSEJiF5k7946rIZGamG6QWgRxtpIglD4/Zw==}
cpu: [x64]
os: [win32]
'@oven/bun-windows-x64@1.1.30':
resolution: {integrity: sha512-mdRjNtD9NIA8CiH6N1zrIVE6oAtDko/c29H1s00UA+5O/WhXhg95G8IyInD8hN3vAEz8H2lGBgLG2EGfSFxnGg==}
cpu: [x64]
os: [win32]
bun@1.1.30:
resolution: {integrity: sha512-ysRL1pq10Xba0jqVLPrKU3YIv0ohfp3cTajCPtpjCyppbn3lfiAVNpGoHfyaxS17OlPmWmR67UZRPw/EueQuug==}
cpu: [arm64, x64]
os: [darwin, linux, win32]
hasBin: true
snapshots:
'@oven/bun-darwin-aarch64@1.1.30':
optional: true
'@oven/bun-darwin-x64-baseline@1.1.30':
optional: true
'@oven/bun-darwin-x64@1.1.30':
optional: true
'@oven/bun-linux-aarch64@1.1.30':
optional: true
'@oven/bun-linux-x64-baseline@1.1.30':
optional: true
'@oven/bun-linux-x64@1.1.30':
optional: true
'@oven/bun-windows-x64-baseline@1.1.30':
optional: true
'@oven/bun-windows-x64@1.1.30':
optional: true
bun@1.1.30:
optionalDependencies:
'@oven/bun-darwin-aarch64': 1.1.30
'@oven/bun-darwin-x64': 1.1.30
'@oven/bun-darwin-x64-baseline': 1.1.30
'@oven/bun-linux-aarch64': 1.1.30
'@oven/bun-linux-x64': 1.1.30
'@oven/bun-linux-x64-baseline': 1.1.30
'@oven/bun-windows-x64': 1.1.30
'@oven/bun-windows-x64-baseline': 1.1.30

View File

@ -4,5 +4,8 @@
"https://git.1-h.cc/examples/renovate-example/raw/branch/main/default.json5",
":automergeAll"
],
"dependencyDashboard": false
"dependencyDashboard": false,
"packageRules": [
{ "minimumReleaseAge": "1 days", "matchPackageNames": [ "*" ] }
]
}

View File

@ -38,48 +38,44 @@ runs:
shell: bash
id: prepare
run: |
# Check package manager
# 判断是否需要 pnpm/action-setup
echo "#############################"
setupPnpm=false
packageManager=$(node -p "require('./package.json').packageManager")
echo "##########################################################"
echo "packageManager: $packageManager found in package.json"
echo ""
if [[ "$packageManager" == "pnpm"* ]]; then
echo "##########################################################"
# TODO: 还有一种情况就是镜像中已经安装了pnpm。
echo "setup-pnpm=true"
echo ""
echo "setup-pnpm=true" >> $GITHUB_OUTPUT
if [[ "$packageManager" == "pnpm"* ]] && ! which pnpm > /dev/null; then
echo "the package manager is pnpm but pnpm is not installed"
setupPnpm=true
else
echo "the package manager is not pnpm or pnpm is already installed"
fi
# Check if pnpm-lock.yaml exists
if [[ -f "pnpm-lock.yaml" ]]; then
echo "##########################################################"
echo "pnpm-lock.yaml exists. So pnpm install --frozen-lockfile will run"
echo "setupPnpm: $setupPnpm"
echo "setup-pnpm=$setupPnpm" >> $GITHUB_OUTPUT
echo ""
# 判断是否需要运行 pnpm install
echo "#############################"
if [[ -f "pnpm-lock.yaml" ]]; then
echo "pnpm-lock.yaml exists. So pnpm install --frozen-lockfile will run"
echo "pnpm-lock-exists=true" >> $GITHUB_OUTPUT
echo "cache=pnpm" >> $GITHUB_OUTPUT
else
echo "pnpm-lock.yaml does not exist"
echo "pnpm-lock.yaml does not exist. So pnpm install will not run"
fi
echo ""
# Extract the node version from the .npmrc file
# 设置 node 版本
echo "#############################"
nodeVersion=$(sed -n 's/.*use-node-version=\([0-9.]*\).*/\1/p' .npmrc)
if [[ -z "$nodeVersion" ]]; then
nodeVersion="lts/*"
echo "##########################################################"
echo "Node version not found in .npmrc. Using default: $nodeVersion"
echo ""
else
echo "##########################################################"
echo "Node version found in .npmrc: $nodeVersion"
echo ""
fi
echo "node-version=$nodeVersion" >> $GITHUB_OUTPUT
echo ""
- uses: pnpm/action-setup@v4 # https://github.com/pnpm/action-setup?tab=readme-ov-file#inputs
if: steps.prepare.outputs.setup-pnpm == 'true'
@ -87,6 +83,8 @@ runs:
with:
node-version: ${{ steps.prepare.outputs.node-version }}
cache: ${{ steps.prepare.outputs.cache }}
- run: cat .npmrc
shell: bash
- name: 📦 Install Project Dependencies
if: steps.prepare.outputs.pnpm-lock-exists == 'true'
run: pnpm install --frozen-lockfile