mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
This PR includes the following changes: - **Upgrade `.golangci.yml`**: Updated the configuration file to align with the latest golangci-lint version, ensuring compatibility and leveraging new features. - **Refactor GitHub Action workflow**: Modified `golangci-lint.yml` in the GitHub Actions workflow to reflect the updated configuration and improve CI performance. - **Codebase optimization**: Refactored code to address issues and warnings raised by the updated golangci-lint rules, including: - Improved function length and complexity. - Enhanced error handling and variable naming conventions. - Fixed minor issues such as unused imports and formatting inconsistencies. These changes aim to maintain code quality, ensure compatibility with the latest tools, and improve overall maintainability.
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: GoFrame Release
|
|
|
|
on:
|
|
push:
|
|
# Sequence of patterns matched against refs/tags
|
|
tags:
|
|
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
|
|
|
env:
|
|
TZ: Asia/Shanghai
|
|
|
|
|
|
jobs:
|
|
build:
|
|
name: Build And Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Github Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set Up Golang Environment
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.24.2
|
|
|
|
- name: Build CLI Binary
|
|
run: |
|
|
echo "Building linux amd64 binary..."
|
|
cd cmd/gf
|
|
GOOS=linux GOARCH=amd64 go build main.go
|
|
chmod +x main
|
|
./main install -y
|
|
|
|
- name: Build CLI Binary For All Platform
|
|
run: |
|
|
cd cmd/gf
|
|
gf build main.go -n gf -a all -s all -p temp
|
|
|
|
- name: Move Files Before Release
|
|
run: |
|
|
cd cmd/gf/temp
|
|
for OS in *;do for FILE in $OS/*;\
|
|
do if [[ ${OS} =~ 'windows' ]];\
|
|
then mv $FILE gf_$OS.exe && rm -rf $OS;\
|
|
else mv $FILE gf_$OS && rm -rf $OS;\
|
|
fi;done;done
|
|
|
|
- name: Create Github Release
|
|
id: create_release
|
|
uses: softprops/action-gh-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
name: GoFrame Release ${{ github.ref }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload Release Asset
|
|
id: upload-release-asset
|
|
uses: alexellis/upload-assets@0.4.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
asset_paths: '["cmd/gf/temp/gf_*"]'
|