Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 1 addition & 76 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,79 +151,4 @@ jobs:

echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Build binaries
if: steps.version.outputs.skip_release != 'true'
run: |
VERSION=${{ steps.version.outputs.new_version }}
mkdir -p dist

# 构建不同平台的二进制文件
platforms=("linux/amd64" "linux/arm64" "windows/amd64" "darwin/amd64" "darwin/arm64")

for platform in "${platforms[@]}"; do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}

output_name="bamboo-exporter-${VERSION}-${GOOS}-${GOARCH}"
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

echo "Building for $GOOS/$GOARCH..."
env CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build \
-ldflags="-s -w -X main.version=${VERSION}" \
-o dist/$output_name .

# 创建压缩包
cd dist
if [ $GOOS = "windows" ]; then
zip ${output_name%.exe}.zip $output_name
rm $output_name
else
tar -czf ${output_name}.tar.gz $output_name
rm $output_name
fi
cd ..
done

- name: Create Release
if: steps.version.outputs.skip_release != 'true'
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.new_version }}
release_name: Release ${{ steps.version.outputs.new_version }}
body: |
## 🚀 What's New

${{ steps.version.outputs.changelog }}

## 📦 Download

选择适合你平台的二进制文件下载:
- **Linux (x64)**: `bamboo-exporter-${{ steps.version.outputs.new_version }}-linux-amd64.tar.gz`
- **Linux (ARM64)**: `bamboo-exporter-${{ steps.version.outputs.new_version }}-linux-arm64.tar.gz`
- **Windows (x64)**: `bamboo-exporter-${{ steps.version.outputs.new_version }}-windows-amd64.zip`
- **macOS (Intel)**: `bamboo-exporter-${{ steps.version.outputs.new_version }}-darwin-amd64.tar.gz`
- **macOS (Apple Silicon)**: `bamboo-exporter-${{ steps.version.outputs.new_version }}-darwin-arm64.tar.gz`
draft: false
prerelease: false

- name: Upload Release Assets
if: steps.version.outputs.skip_release != 'true'
run: |
upload_url="${{ steps.create_release.outputs.upload_url }}"

for file in dist/*; do
filename=$(basename "$file")
echo "Uploading $filename..."
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file" \
"${upload_url%{?name,label}*}?name=$filename"
done
echo "EOF" >> $GITHUB_OUTPUT
Loading