mirror of
https://github.com/yanhao98/composite-actions.git
synced 2025-07-14 07:10:48 +08:00
Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
b321d0e415 | |||
a436649d0b | |||
8c48919d2b | |||
2d9eca2894 | |||
64d6ac9814 | |||
c7b53ebd10 | |||
f7e317688b | |||
ea235bf784 | |||
f49701ce53 | |||
92a737252b | |||
13dd5d7bdb | |||
e7fd5cc26b | |||
d3c52b5b83 | |||
52dbb4ce12 | |||
c7fa63d9b5 | |||
de21dcf6bd | |||
e57f1a275b | |||
f835a63583 | |||
6cf720250a | |||
76e102f6a5 | |||
2dda4ee55a | |||
e01a0b34d8 | |||
5195d74ff1 | |||
6e58674f53 | |||
ced3572c0a | |||
3ef624f5d9 | |||
f7f95de95a |
4
.github/workflows/deploy-dist-to-surge.yml
vendored
4
.github/workflows/deploy-dist-to-surge.yml
vendored
@ -1,4 +1,8 @@
|
|||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "deploy-dist-to-surge.yml/**"
|
||||||
|
- ".github/workflows/deploy-dist-to-surge.yml"
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- "deploy-dist-to-surge.yml/**"
|
- "deploy-dist-to-surge.yml/**"
|
||||||
|
8
.github/workflows/docker-build-push.yml
vendored
8
.github/workflows/docker-build-push.yml
vendored
@ -1,4 +1,8 @@
|
|||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "docker-build-push/**"
|
||||||
|
- ".github/workflows/docker-build-push.yml"
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- "docker-build-push/**"
|
- "docker-build-push/**"
|
||||||
@ -8,6 +12,10 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
job:
|
job:
|
||||||
|
# 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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
|
27
.github/workflows/setup-node-environment.yml
vendored
27
.github/workflows/setup-node-environment.yml
vendored
@ -1,4 +1,8 @@
|
|||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "setup-node-environment/**"
|
||||||
|
- ".github/workflows/setup-node-environment.yml"
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- "setup-node-environment/**"
|
- "setup-node-environment/**"
|
||||||
@ -7,12 +11,12 @@ env:
|
|||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
job:
|
job-1:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
container-image: ["", "yanhao98/runner-images:pnpm"]
|
container-image: ["", "yanhao98/runner-images:pnpm"]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.container-image }}
|
image: ${{ matrix.container-image }}
|
||||||
steps:
|
steps:
|
||||||
@ -31,7 +35,11 @@ jobs:
|
|||||||
node -v;
|
node -v;
|
||||||
pnpm 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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
@ -51,3 +59,16 @@ jobs:
|
|||||||
which pnpm;
|
which pnpm;
|
||||||
node -v;
|
node -v;
|
||||||
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
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules
|
@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"packageManager": "pnpm@9.11.0"
|
"packageManager": "pnpm@9.11.0",
|
||||||
|
"dependencies": {
|
||||||
|
"bun": "^1.1.30"
|
||||||
|
}
|
||||||
}
|
}
|
91
pnpm-lock.yaml
generated
91
pnpm-lock.yaml
generated
@ -6,4 +6,93 @@ settings:
|
|||||||
|
|
||||||
importers:
|
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
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"extends": [
|
||||||
"https://git.1-h.cc/examples/renovate-example/raw/branch/main/default.json5"
|
"https://git.1-h.cc/examples/renovate-example/raw/branch/main/default.json5",
|
||||||
|
":automergeAll"
|
||||||
],
|
],
|
||||||
"dependencyDashboard": false
|
"dependencyDashboard": false,
|
||||||
|
"packageRules": [
|
||||||
|
{ "minimumReleaseAge": "1 days", "matchPackageNames": [ "*" ] }
|
||||||
|
]
|
||||||
}
|
}
|
@ -38,48 +38,44 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
# Check package manager
|
# 判断是否需要 pnpm/action-setup
|
||||||
|
echo "#############################"
|
||||||
|
setupPnpm=false
|
||||||
packageManager=$(node -p "require('./package.json').packageManager")
|
packageManager=$(node -p "require('./package.json').packageManager")
|
||||||
echo "##########################################################"
|
|
||||||
echo "packageManager: $packageManager found in package.json"
|
echo "packageManager: $packageManager found in package.json"
|
||||||
echo ""
|
if [[ "$packageManager" == "pnpm"* ]] && ! which pnpm > /dev/null; then
|
||||||
|
echo "the package manager is pnpm but pnpm is not installed"
|
||||||
if [[ "$packageManager" == "pnpm"* ]]; then
|
setupPnpm=true
|
||||||
echo "##########################################################"
|
else
|
||||||
# TODO: 还有一种情况就是镜像中已经安装了pnpm。
|
echo "the package manager is not pnpm or pnpm is already installed"
|
||||||
echo "setup-pnpm=true"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "setup-pnpm=true" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
|
echo "setupPnpm: $setupPnpm"
|
||||||
# Check if pnpm-lock.yaml exists
|
echo "setup-pnpm=$setupPnpm" >> $GITHUB_OUTPUT
|
||||||
if [[ -f "pnpm-lock.yaml" ]]; then
|
|
||||||
echo "##########################################################"
|
|
||||||
echo "pnpm-lock.yaml exists. So pnpm install --frozen-lockfile will run"
|
|
||||||
echo ""
|
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 "pnpm-lock-exists=true" >> $GITHUB_OUTPUT
|
||||||
echo "cache=pnpm" >> $GITHUB_OUTPUT
|
echo "cache=pnpm" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "pnpm-lock.yaml does not exist"
|
echo "pnpm-lock.yaml does not exist. So pnpm install will not run"
|
||||||
fi
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
# Extract the node version from the .npmrc file
|
# 设置 node 版本
|
||||||
|
echo "#############################"
|
||||||
nodeVersion=$(sed -n 's/.*use-node-version=\([0-9.]*\).*/\1/p' .npmrc)
|
nodeVersion=$(sed -n 's/.*use-node-version=\([0-9.]*\).*/\1/p' .npmrc)
|
||||||
if [[ -z "$nodeVersion" ]]; then
|
if [[ -z "$nodeVersion" ]]; then
|
||||||
nodeVersion="lts/*"
|
nodeVersion="lts/*"
|
||||||
echo "##########################################################"
|
|
||||||
echo "Node version not found in .npmrc. Using default: $nodeVersion"
|
echo "Node version not found in .npmrc. Using default: $nodeVersion"
|
||||||
echo ""
|
|
||||||
else
|
else
|
||||||
echo "##########################################################"
|
|
||||||
echo "Node version found in .npmrc: $nodeVersion"
|
echo "Node version found in .npmrc: $nodeVersion"
|
||||||
echo ""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "node-version=$nodeVersion" >> $GITHUB_OUTPUT
|
echo "node-version=$nodeVersion" >> $GITHUB_OUTPUT
|
||||||
|
echo ""
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v4 # https://github.com/pnpm/action-setup?tab=readme-ov-file#inputs
|
- uses: pnpm/action-setup@v4 # https://github.com/pnpm/action-setup?tab=readme-ov-file#inputs
|
||||||
if: steps.prepare.outputs.setup-pnpm == 'true'
|
if: steps.prepare.outputs.setup-pnpm == 'true'
|
||||||
@ -87,6 +83,8 @@ runs:
|
|||||||
with:
|
with:
|
||||||
node-version: ${{ steps.prepare.outputs.node-version }}
|
node-version: ${{ steps.prepare.outputs.node-version }}
|
||||||
cache: ${{ steps.prepare.outputs.cache }}
|
cache: ${{ steps.prepare.outputs.cache }}
|
||||||
|
- run: cat .npmrc
|
||||||
|
shell: bash
|
||||||
- name: 📦 Install Project Dependencies
|
- name: 📦 Install Project Dependencies
|
||||||
if: steps.prepare.outputs.pnpm-lock-exists == 'true'
|
if: steps.prepare.outputs.pnpm-lock-exists == 'true'
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
Reference in New Issue
Block a user