github.com/wangyougui/gf/v2@v2.6.5/.github/workflows/release.yml (about)

     1  name: GoFrame Release
     2  
     3  on:
     4    push:
     5      # Sequence of patterns matched against refs/tags
     6      tags:
     7      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
     8  
     9  env:
    10    TZ: Asia/Shanghai
    11  
    12  
    13  jobs:
    14    build:
    15      name: Build And Release
    16      runs-on: ubuntu-latest
    17      steps:
    18        - name: Checkout Github Code
    19          uses: actions/checkout@v4
    20        
    21        - name: Set Up Golang Environment
    22          uses: actions/setup-go@v5
    23          with:
    24            go-version: 1.20.8
    25        
    26        - name: Build CLI Binary
    27          run: |
    28            echo "Building linux amd64 binary..."
    29            cd cmd/gf
    30            GOOS=linux GOARCH=amd64 go build main.go
    31            chmod +x main
    32            ./main install -y
    33  
    34        - name: Build CLI Binary For All Platform
    35          run: |
    36            cd cmd/gf
    37            gf build main.go -n gf -a all -s all -p temp
    38  
    39        - name: Move Files Before Release
    40          run: |
    41            cd cmd/gf/temp
    42            for OS in *;do for FILE in $OS/*;\
    43            do if [[ ${OS} =~ 'windows' ]];\
    44            then mv $FILE gf_$OS.exe && rm -rf $OS;\
    45            else mv $FILE gf_$OS && rm -rf $OS;\
    46            fi;done;done
    47  
    48        - name: Create Github Release
    49          id: create_release
    50          uses: softprops/action-gh-release@v1
    51          env:
    52            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    53          with:
    54            tag_name:     ${{ github.ref }}
    55            name: GoFrame Release ${{ github.ref }}
    56            draft:        false
    57            prerelease:   false
    58        
    59        - name: Upload Release Asset
    60          id:   upload-release-asset
    61          uses: alexellis/upload-assets@0.4.0
    62          env:
    63            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    64          with:
    65            asset_paths: '["cmd/gf/temp/gf_*"]'