mirror of
https://github.com/ayflying/p2p.git
synced 2026-03-05 09:49:22 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
680d36e526 | ||
|
|
0a5432406a |
41
.github/workflows/release.yml
vendored
41
.github/workflows/release.yml
vendored
@@ -23,42 +23,17 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4 # 使用最新稳定的v4版本
|
uses: actions/checkout@v4 # 使用最新稳定的v4版本
|
||||||
|
|
||||||
- name: Cache Go installation
|
# GitHub Actions的runner环境通常已预装Go,Setup Go步骤会处理版本管理
|
||||||
uses: actions/cache@v4
|
|
||||||
id: cache-go
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.go
|
|
||||||
/usr/local/go
|
|
||||||
key: go-installation-${{ runner.os }}-${{ hashFiles('.github/workflows/release.yml') }}
|
|
||||||
restore-keys: |
|
|
||||||
go-installation-${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 'stable' # 使用最新稳定版本的Go,无需手动更新版本号
|
go-version: 'stable' # 使用最新稳定版本的Go,无需手动更新版本号
|
||||||
cache: true # 启用Go模块缓存
|
|
||||||
cache-dependency-path: go.sum # 使用go.sum作为缓存键的一部分
|
|
||||||
|
|
||||||
- name: Cache GF CLI
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ${{ github.workspace }}/gf
|
|
||||||
key: gf-cli-${{ hashFiles('**/go.mod') }}
|
|
||||||
restore-keys: gf-cli-
|
|
||||||
|
|
||||||
- name: Install gf CLI
|
- name: Install gf CLI
|
||||||
run: |
|
run: |
|
||||||
# 如果缓存中已有gf CLI,直接复制到bin目录,否则下载
|
# 直接下载GF CLI,不使用缓存以避免超时问题
|
||||||
if [ -f "${{ github.workspace }}/gf" ]; then
|
echo "Downloading GF CLI"
|
||||||
echo "Using cached GF CLI"
|
curl -L -o gf https://github.com/gogf/gf/releases/latest/download/gf_linux_amd64
|
||||||
chmod +x "${{ github.workspace }}/gf"
|
chmod +x gf
|
||||||
else
|
|
||||||
echo "Downloading GF CLI"
|
|
||||||
curl -L -o gf https://github.com/gogf/gf/releases/latest/download/gf_linux_amd64
|
|
||||||
chmod +x gf
|
|
||||||
fi
|
|
||||||
mkdir -p "$HOME/bin"
|
mkdir -p "$HOME/bin"
|
||||||
mv gf "$HOME/bin/gf"
|
mv gf "$HOME/bin/gf"
|
||||||
echo "$HOME/bin" >> $GITHUB_PATH
|
echo "$HOME/bin" >> $GITHUB_PATH
|
||||||
@@ -70,8 +45,7 @@ jobs:
|
|||||||
run: gf build -ew -v "${{ github.ref_name }}"
|
run: gf build -ew -v "${{ github.ref_name }}"
|
||||||
|
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
# 使用main分支以获取最新版本的action,无需手动更新版本号
|
uses: actions/upload-artifact@v4 # 使用v4版本
|
||||||
uses: actions/upload-artifact@main
|
|
||||||
with:
|
with:
|
||||||
name: p2p-${{ github.ref_name }}
|
name: p2p-${{ github.ref_name }}
|
||||||
path: |
|
path: |
|
||||||
@@ -89,8 +63,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
# 使用main分支以获取最新版本的action,无需手动更新版本号
|
uses: actions/download-artifact@v4 # 使用v4版本
|
||||||
uses: actions/download-artifact@main
|
|
||||||
with:
|
with:
|
||||||
name: p2p-${{ github.ref_name }}
|
name: p2p-${{ github.ref_name }}
|
||||||
path: bin
|
path: bin
|
||||||
|
|||||||
Reference in New Issue
Block a user