github.com/database64128/shadowsocks-go@v1.10.2-0.20240315062903-143a773533f1/.github/workflows/release.yml (about)

     1  name: Release
     2  
     3  on:
     4    push:
     5      tags:
     6        - 'v*'
     7  
     8  jobs:
     9    publish_upload:
    10      name: Publish and upload
    11      runs-on: ubuntu-latest
    12      container:
    13        image: archlinux/archlinux:base-devel
    14  
    15      steps:
    16        - name: Install Git & Go
    17          run: pacman -Syu --needed --noconfirm gcc git go
    18  
    19        - name: Disable Git's stupid security theater
    20          run: git config --global safe.directory '*'
    21  
    22        - name: Git Checkout Tag
    23          run: |
    24            cd ../
    25            rm -rf ${{ github.event.repository.name }}
    26            git clone --branch ${{ github.ref_name }} https://github.com/${{ github.repository }}.git
    27  
    28        - name: Build
    29          run: |
    30            mkdir package-archlinux-x86-64-v2 \
    31                  package-archlinux-x86-64-v3 \
    32                  package-linux-x86-64-v2 \
    33                  package-linux-x86-64-v3 \
    34                  package-linux-arm64 \
    35                  package-windows-x86-64-v2 \
    36                  package-windows-x86-64-v3 \
    37                  package-windows-arm64 \
    38                  package-macos-x86-64-v3 \
    39                  package-macos-arm64 \ 
    40  
    41            env GOAMD64=v2 go build -v -trimpath -ldflags '-s -w' -o package-archlinux-x86-64-v2/ ./cmd/shadowsocks-go
    42            env GOAMD64=v3 go build -v -trimpath -ldflags '-s -w' -o package-archlinux-x86-64-v3/ ./cmd/shadowsocks-go
    43            env CGO_ENABLED=0 GOAMD64=v2 go build -v -trimpath -ldflags '-s -w' -o package-linux-x86-64-v2/ ./cmd/shadowsocks-go
    44            env CGO_ENABLED=0 GOAMD64=v3 go build -v -trimpath -ldflags '-s -w' -o package-linux-x86-64-v3/ ./cmd/shadowsocks-go
    45            env CGO_ENABLED=0 GOARCH=arm64 go build -v -trimpath -ldflags '-s -w' -o package-linux-arm64/ ./cmd/shadowsocks-go
    46            env CGO_ENABLED=0 GOAMD64=v2 GOOS=windows go build -v -trimpath -ldflags '-s -w' -o package-windows-x86-64-v2/ ./cmd/shadowsocks-go
    47            env CGO_ENABLED=0 GOAMD64=v3 GOOS=windows go build -v -trimpath -ldflags '-s -w' -o package-windows-x86-64-v3/ ./cmd/shadowsocks-go
    48            env CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -v -trimpath -ldflags '-s -w' -o package-windows-arm64/ ./cmd/shadowsocks-go
    49            env CGO_ENABLED=0 GOAMD64=v3 GOOS=darwin go build -v -trimpath -ldflags '-s -w' -o package-macos-x86-64-v3/ ./cmd/shadowsocks-go
    50            env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -v -trimpath -ldflags '-s -w' -o package-macos-arm64/ ./cmd/shadowsocks-go
    51  
    52            env GOAMD64=v2 go build -v -trimpath -ldflags '-s -w' -o package-archlinux-x86-64-v2/ ./cmd/shadowsocks-go-domain-set-converter
    53            env GOAMD64=v3 go build -v -trimpath -ldflags '-s -w' -o package-archlinux-x86-64-v3/ ./cmd/shadowsocks-go-domain-set-converter
    54            env CGO_ENABLED=0 GOAMD64=v2 go build -v -trimpath -ldflags '-s -w' -o package-linux-x86-64-v2/ ./cmd/shadowsocks-go-domain-set-converter
    55            env CGO_ENABLED=0 GOAMD64=v3 go build -v -trimpath -ldflags '-s -w' -o package-linux-x86-64-v3/ ./cmd/shadowsocks-go-domain-set-converter
    56            env CGO_ENABLED=0 GOARCH=arm64 go build -v -trimpath -ldflags '-s -w' -o package-linux-arm64/ ./cmd/shadowsocks-go-domain-set-converter
    57            env CGO_ENABLED=0 GOAMD64=v2 GOOS=windows go build -v -trimpath -ldflags '-s -w' -o package-windows-x86-64-v2/ ./cmd/shadowsocks-go-domain-set-converter
    58            env CGO_ENABLED=0 GOAMD64=v3 GOOS=windows go build -v -trimpath -ldflags '-s -w' -o package-windows-x86-64-v3/ ./cmd/shadowsocks-go-domain-set-converter
    59            env CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -v -trimpath -ldflags '-s -w' -o package-windows-arm64/ ./cmd/shadowsocks-go-domain-set-converter
    60            env CGO_ENABLED=0 GOAMD64=v3 GOOS=darwin go build -v -trimpath -ldflags '-s -w' -o package-macos-x86-64-v3/ ./cmd/shadowsocks-go-domain-set-converter
    61            env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -v -trimpath -ldflags '-s -w' -o package-macos-arm64/ ./cmd/shadowsocks-go-domain-set-converter
    62  
    63        - name: Package
    64          env:
    65            ZSTD_CLEVEL: 19
    66            ZSTD_NBTHREADS: 2
    67          run: |
    68            cd package-archlinux-x86-64-v2/
    69            tar -acf ../shadowsocks-go-${{ github.ref_name }}-archlinux-x86-64-v2.tar.zst .
    70            cd ../package-archlinux-x86-64-v3/
    71            tar -acf ../shadowsocks-go-${{ github.ref_name }}-archlinux-x86-64-v3.tar.zst .
    72            cd ../package-linux-x86-64-v2/
    73            tar -acf ../shadowsocks-go-${{ github.ref_name }}-linux-x86-64-v2.tar.zst .
    74            cd ../package-linux-x86-64-v3/
    75            tar -acf ../shadowsocks-go-${{ github.ref_name }}-linux-x86-64-v3.tar.zst .
    76            cd ../package-linux-arm64/
    77            tar -acf ../shadowsocks-go-${{ github.ref_name }}-linux-arm64.tar.zst .
    78            cd ../package-windows-x86-64-v2/
    79            tar -acf ../shadowsocks-go-${{ github.ref_name }}-windows-x86-64-v2.tar.zst .
    80            cd ../package-windows-x86-64-v3/
    81            tar -acf ../shadowsocks-go-${{ github.ref_name }}-windows-x86-64-v3.tar.zst .
    82            cd ../package-windows-arm64/
    83            tar -acf ../shadowsocks-go-${{ github.ref_name }}-windows-arm64.tar.zst .
    84            cd ../package-macos-x86-64-v3/
    85            tar -acf ../shadowsocks-go-${{ github.ref_name }}-macos-x86-64-v3.tar.zst .
    86            cd ../package-macos-arm64/
    87            tar -acf ../shadowsocks-go-${{ github.ref_name }}-macos-arm64.tar.zst .
    88  
    89        - name: Upload release assets
    90          uses: svenstaro/upload-release-action@v2
    91          with:
    92            repo_token: ${{ secrets.GITHUB_TOKEN }}
    93            file: shadowsocks-go-*.tar.zst
    94            tag: ${{ github.ref }}
    95            file_glob: true
    96            draft: true