Skip to content

Commit

Permalink
fix: github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
fanhaodong.516 committed Sep 21, 2024
1 parent fb9c162 commit 51ef128
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
41 changes: 34 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ jobs:
- name: Apt Install ...
run: sudo apt-get update; sudo apt-get install libpcap-dev # install libpcap for gopcap-sdk
- name: Build project
run: |
make cors
make build
zip bin/devtool.zip -@ < .github/workflows/devtool.txt
run: make release_assert
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -42,13 +39,43 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload to Release
- name: Upload to Release darwin_arm64
id: upload-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: ./bin/devtool.zip
asset_name: devtool.zip
asset_path: ./bin/devtool_darwin_arm64.zip
asset_name: devtool_darwin_arm64.zip
asset_content_type: application/zip
- name: Upload to Release darwin_amd64
id: upload-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: ./bin/devtool_darwin_amd64.zip
asset_name: devtool_darwin_amd64.zip
asset_content_type: application/zip
- name: Upload to Release linux_amd64
id: upload-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: ./bin/devtool_linux_amd64.zip
asset_name: devtool_linux_amd64.zip
asset_content_type: application/zip
- name: Upload to Release windows_amd64
id: upload-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: ./bin/devtool_windows_amd64.zip
asset_name: devtool_windows_amd64.zip
asset_content_type: application/zip
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ check:
test: ## go tool cover -html=cover.out
go test -coverprofile cover.out -count=1 ./pkg/...

.PHONY: release_assert
release_assert: build cors ## 创建 release assert
mv bin/tcpdump_tools bin/$$(go env GOOS)_$$(go env GOARCH)
zip -j bin/devtool_darwin_amd64.zip bin/darwin_amd64/*
zip -j bin/devtool_darwin_arm64.zip bin/darwin_arm64/*
zip -j bin/devtool_linux_amd64.zip bin/linux_amd64/*
zip -j bin/devtool_windows_amd64.zip bin/windows_amd64/*

.PHONY: help
help: ## help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

0 comments on commit 51ef128

Please sign in to comment.