mirror of
https://git.bjxgj.com/xgj/xgj-actions.git
synced 2025-10-14 06:33:37 +08:00
Merge branch 'v1'
This commit is contained in:
@@ -52,8 +52,8 @@ outputs:
|
|||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: 确定锁文件
|
- name: 检测锁文件
|
||||||
id: lockfile
|
id: detect-lockfile
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
LOCKFILE="${{ inputs.lockfile-name }}"
|
LOCKFILE="${{ inputs.lockfile-name }}"
|
||||||
@@ -79,19 +79,23 @@ runs:
|
|||||||
- name: 生成缓存key
|
- name: 生成缓存key
|
||||||
id: cache-key
|
id: cache-key
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
LOCKFILE_HASH: ${{ hashFiles(steps.detect-lockfile.outputs.lockfile) }}
|
||||||
run: |
|
run: |
|
||||||
# 根据检测到的锁文件生成hash
|
LOCKFILE="${{ steps.detect-lockfile.outputs.lockfile }}"
|
||||||
LOCKFILE="${{ steps.lockfile.outputs.lockfile }}"
|
|
||||||
if [[ -f "${LOCKFILE}" ]]; then
|
# 截取hash的前12位
|
||||||
# 使用sha256计算文件hash并取前12位
|
if [[ -n "${LOCKFILE_HASH}" && "${LOCKFILE_HASH}" != "" ]]; then
|
||||||
HASH=$(sha256sum "${LOCKFILE}" | cut -d' ' -f1 | head -c 12)
|
LOCKFILE_HASH_SHORT=$(echo "${LOCKFILE_HASH}" | head -c 12)
|
||||||
else
|
else
|
||||||
echo "⚠️ 警告: 锁文件 ${LOCKFILE} 不存在,使用时间戳作为fallback"
|
echo "⚠️ 警告: 无法计算锁文件hash,使用默认值"
|
||||||
HASH=$(date +%s | tail -c 8)
|
LOCKFILE_HASH_SHORT="no-lockfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CACHE_KEY="${{ runner.os }}-${{ inputs.cache-prefix }}-${HASH}"
|
CACHE_KEY="${{ runner.os }}-${{ inputs.cache-prefix }}-${LOCKFILE_HASH_SHORT}"
|
||||||
echo "key=${CACHE_KEY}" >> $GITHUB_OUTPUT
|
echo "key=${CACHE_KEY}" >> $GITHUB_OUTPUT
|
||||||
|
echo "锁文件: ${LOCKFILE}"
|
||||||
|
echo "文件hash: ${LOCKFILE_HASH}"
|
||||||
echo "缓存key: ${CACHE_KEY}"
|
echo "缓存key: ${CACHE_KEY}"
|
||||||
|
|
||||||
- name: 拉取缓存依赖
|
- name: 拉取缓存依赖
|
||||||
|
@@ -57,7 +57,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: 获取版本信息
|
- name: 获取版本信息
|
||||||
id: version-info
|
id: version-info
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
|
|
||||||
- name: 显示版本信息
|
- name: 显示版本信息
|
||||||
run: |
|
run: |
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
```yaml
|
```yaml
|
||||||
- name: 获取版本信息(自定义前缀)
|
- name: 获取版本信息(自定义前缀)
|
||||||
id: version-info
|
id: version-info
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
with:
|
with:
|
||||||
version-prefix: "release-"
|
version-prefix: "release-"
|
||||||
```
|
```
|
||||||
@@ -104,7 +104,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: 获取版本信息
|
- name: 获取版本信息
|
||||||
id: version-info
|
id: version-info
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
|
|
||||||
- name: 检查是否需要部署
|
- name: 检查是否需要部署
|
||||||
id: check-deploy
|
id: check-deploy
|
||||||
|
@@ -25,7 +25,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 获取触发版本信息
|
- name: 获取触发版本信息
|
||||||
id: version-info
|
id: version-info
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
|
|
||||||
- name: 显示版本信息
|
- name: 显示版本信息
|
||||||
run: |
|
run: |
|
||||||
|
@@ -25,7 +25,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 获取版本信息
|
- name: 获取版本信息
|
||||||
id: version-info
|
id: version-info
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
|
|
||||||
- name: 确定部署策略
|
- name: 确定部署策略
|
||||||
id: deployment-strategy
|
id: deployment-strategy
|
||||||
|
@@ -19,7 +19,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 获取标准版本信息
|
- name: 获取标准版本信息
|
||||||
id: standard-version
|
id: standard-version
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
# 使用默认的 'v' 前缀
|
# 使用默认的 'v' 前缀
|
||||||
|
|
||||||
- name: 显示标准版本信息
|
- name: 显示标准版本信息
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 获取发布版本信息
|
- name: 获取发布版本信息
|
||||||
id: release-version
|
id: release-version
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
with:
|
with:
|
||||||
version-prefix: 'release-'
|
version-prefix: 'release-'
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 获取热修复版本信息
|
- name: 获取热修复版本信息
|
||||||
id: hotfix-version
|
id: hotfix-version
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
with:
|
with:
|
||||||
version-prefix: 'hotfix-'
|
version-prefix: 'hotfix-'
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 获取无前缀版本信息
|
- name: 获取无前缀版本信息
|
||||||
id: no-prefix-version
|
id: no-prefix-version
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
with:
|
with:
|
||||||
version-prefix: ''
|
version-prefix: ''
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 使用动态前缀获取版本信息
|
- name: 使用动态前缀获取版本信息
|
||||||
id: dynamic-version
|
id: dynamic-version
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
with:
|
with:
|
||||||
version-prefix: ${{ env.VERSION_PREFIX }}
|
version-prefix: ${{ env.VERSION_PREFIX }}
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 获取触发版本信息
|
- name: 获取触发版本信息
|
||||||
id: version-info
|
id: version-info
|
||||||
uses: ./trigger-version
|
uses: actions/xgj/trigger-version@v1
|
||||||
|
|
||||||
- name: 确定构建和部署策略
|
- name: 确定构建和部署策略
|
||||||
id: build-strategy
|
id: build-strategy
|
||||||
|
Reference in New Issue
Block a user