bugFix:修复下载测速 #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Build for Windows | |
env: | |
GOOS: windows | |
GOARCH: amd64 | |
run: go build -o speedtest.exe | |
- name: Get tag description | |
id: tag_description | |
run: | | |
TAG_DESCRIPTION=$(git tag -l --format='%(contents)' ${{ github.ref_name }}) | |
echo "tag_description=${TAG_DESCRIPTION}" >> $GITHUB_ENV | |
- name: Get latest commit message | |
id: commit_message | |
run: | | |
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | |
echo "commit_message=${COMMIT_MESSAGE}" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: "${{ github.ref_name }} ${{ env.tag_description }}" | |
# body: | | |
# ${{ github.action }} :${{ env.commit_message }} | |
draft: false | |
prerelease: false | |
- name: Upload Windows Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./speedtest.exe | |
asset_name: speedtest.exe | |
asset_content_type: application/vnd.microsoft.portable-executable | |