mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
fix: build
This commit is contained in:
parent
da8c1cd699
commit
9852796142
2 changed files with 148 additions and 79 deletions
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
|
@ -42,19 +42,3 @@ jobs:
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags '' -o croc-freebsd-arm64
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags '' -o croc-freebsd-arm64
|
||||||
CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 go build -ldflags '' -o croc-openbsd-amd64
|
CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 go build -ldflags '' -o croc-openbsd-amd64
|
||||||
CGO_ENABLED=0 GOOS=openbsd GOARCH=arm64 go build -ldflags '' -o croc-openbsd-arm64
|
CGO_ENABLED=0 GOOS=openbsd GOARCH=arm64 go build -ldflags '' -o croc-openbsd-arm64
|
||||||
|
|
||||||
- name: Setup Go for Windows 7 Build
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.20.7' # Go 1.20.8+ refuses to build Go 1.23 code
|
|
||||||
|
|
||||||
- name: Build Windows 7 version
|
|
||||||
run: |
|
|
||||||
go version
|
|
||||||
# rm go.mod go.sum
|
|
||||||
# go mod init github.com/schollz/croc/v10
|
|
||||||
# go mod tidy
|
|
||||||
go get golang.org/x/sys@v0.33.0
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-extldflags "-static"' -o croc-windows7-amd64.exe
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags '-extldflags "-static"' -o croc-windows7-386.exe
|
|
||||||
|
|
||||||
|
|
211
.github/workflows/release.yml
vendored
211
.github/workflows/release.yml
vendored
|
@ -9,7 +9,7 @@ permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
prepare-source:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -25,87 +25,172 @@ jobs:
|
||||||
git clone -b ${{ github.event.release.name }} --depth 1 https://github.com/schollz/croc croc-${{ github.event.release.name }}
|
git clone -b ${{ github.event.release.name }} --depth 1 https://github.com/schollz/croc croc-${{ github.event.release.name }}
|
||||||
cd croc-${{ github.event.release.name }} && go mod tidy && go mod vendor
|
cd croc-${{ github.event.release.name }} && go mod tidy && go mod vendor
|
||||||
cd .. && tar -czvf croc_${{ github.event.release.name }}_src.tar.gz croc-${{ github.event.release.name }}
|
cd .. && tar -czvf croc_${{ github.event.release.name }}_src.tar.gz croc-${{ github.event.release.name }}
|
||||||
|
|
||||||
- name: Build files
|
|
||||||
run: |
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-extldflags "-static"' -o croc.exe
|
|
||||||
zip croc_${{ github.event.release.name }}_Windows-64bit.zip croc.exe LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags '-extldflags "-static"' -o croc.exe
|
|
||||||
zip croc_${{ github.event.release.name }}_Windows-32bit.zip croc.exe LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=arm go build -ldflags '-extldflags "-static"' -o croc.exe
|
|
||||||
zip croc_${{ github.event.release.name }}_Windows-ARM.zip croc.exe LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags '-extldflags "-static"' -o croc.exe
|
|
||||||
zip croc_${{ github.event.release.name }}_Windows-ARM64.zip croc.exe LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags '-extldflags "-static"' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_Linux-64bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags '-extldflags "-static"' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_Linux-32bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags '-extldflags "-static"' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_Linux-ARM.tar.gz croc LICENSE
|
|
||||||
GOARM=5 CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags '-extldflags "-static"' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_Linux-ARMv5.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags '-extldflags "-static"' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_Linux-ARM64.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags '-s -extldflags "-sectcreate __TEXT __info_plist Info.plist"' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_macOS-64bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags '-s -extldflags "-sectcreate __TEXT __info_plist Info.plist"' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_macOS-ARM64.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=dragonfly GOARCH=amd64 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_DragonFlyBSD-64bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_FreeBSD-64bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_FreeBSD-ARM64.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=netbsd GOARCH=386 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_NetBSD-32bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=netbsd GOARCH=amd64 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_NetBSD-64bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=netbsd GOARCH=arm64 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_NetBSD-ARM64.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_OpenBSD-64bit.tar.gz croc LICENSE
|
|
||||||
CGO_ENABLED=0 GOOS=openbsd GOARCH=arm64 go build -ldflags '' -o croc
|
|
||||||
tar -czvf croc_${{ github.event.release.name }}_OpenBSD-ARM64.tar.gz croc LICENSE
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload source artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: main-builds
|
name: source-tarball
|
||||||
path: |
|
path: "*.tar.gz"
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
|
|
||||||
build-windows7:
|
build:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
# Windows builds
|
||||||
|
- goos: windows
|
||||||
|
goarch: amd64
|
||||||
|
name: Windows-64bit
|
||||||
|
ext: .exe
|
||||||
|
archive: zip
|
||||||
|
- goos: windows
|
||||||
|
goarch: "386"
|
||||||
|
name: Windows-32bit
|
||||||
|
ext: .exe
|
||||||
|
archive: zip
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm
|
||||||
|
name: Windows-ARM
|
||||||
|
ext: .exe
|
||||||
|
archive: zip
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
|
name: Windows-ARM64
|
||||||
|
ext: .exe
|
||||||
|
archive: zip
|
||||||
|
|
||||||
|
# Linux builds
|
||||||
|
- goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
name: Linux-64bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
- goos: linux
|
||||||
|
goarch: "386"
|
||||||
|
name: Linux-32bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm
|
||||||
|
name: Linux-ARM
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm
|
||||||
|
goarm: "5"
|
||||||
|
name: Linux-ARMv5
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
- goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
name: Linux-ARM64
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
|
||||||
|
# macOS builds
|
||||||
|
- goos: darwin
|
||||||
|
goarch: amd64
|
||||||
|
name: macOS-64bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: '-s -extldflags "-sectcreate __TEXT __info_plist Info.plist"'
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
|
name: macOS-ARM64
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: '-s -extldflags "-sectcreate __TEXT __info_plist Info.plist"'
|
||||||
|
|
||||||
|
# BSD builds
|
||||||
|
- goos: dragonfly
|
||||||
|
goarch: amd64
|
||||||
|
name: DragonFlyBSD-64bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: amd64
|
||||||
|
name: FreeBSD-64bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: arm64
|
||||||
|
name: FreeBSD-ARM64
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
- goos: netbsd
|
||||||
|
goarch: "386"
|
||||||
|
name: NetBSD-32bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
- goos: netbsd
|
||||||
|
goarch: amd64
|
||||||
|
name: NetBSD-64bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
- goos: netbsd
|
||||||
|
goarch: arm64
|
||||||
|
name: NetBSD-ARM64
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
- goos: openbsd
|
||||||
|
goarch: amd64
|
||||||
|
name: OpenBSD-64bit
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
- goos: openbsd
|
||||||
|
goarch: arm64
|
||||||
|
name: OpenBSD-ARM64
|
||||||
|
ext: ""
|
||||||
|
archive: tar.gz
|
||||||
|
ldflags: ""
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Go for Windows 7
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.20.7'
|
go-version: '^1.24.0'
|
||||||
|
|
||||||
- name: Build Windows 7 version
|
- name: Build binary
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
GOOS: ${{ matrix.goos }}
|
||||||
|
GOARCH: ${{ matrix.goarch }}
|
||||||
|
GOARM: ${{ matrix.goarm }}
|
||||||
run: |
|
run: |
|
||||||
go version
|
LDFLAGS="${{ matrix.ldflags }}"
|
||||||
rm -rf go.mod go.sum
|
if [ -z "$LDFLAGS" ] && [ "${{ matrix.goos }}" != "darwin" ] && [ "${{ matrix.goos }}" != "dragonfly" ] && [ "${{ matrix.goos }}" != "freebsd" ] && [ "${{ matrix.goos }}" != "netbsd" ] && [ "${{ matrix.goos }}" != "openbsd" ]; then
|
||||||
go mod init github.com/schollz/croc/v10
|
LDFLAGS='-extldflags "-static"'
|
||||||
go mod tidy
|
fi
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-extldflags "-static"' -o croc.exe
|
go build -ldflags "$LDFLAGS" -o croc${{ matrix.ext }}
|
||||||
zip croc_${{ github.event.release.name }}_Windows7-64bit.zip croc.exe
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags '-extldflags "-static"' -o croc.exe
|
|
||||||
zip croc_${{ github.event.release.name }}_Windows7-32bit.zip croc.exe
|
|
||||||
|
|
||||||
- name: Upload Windows 7 artifacts
|
- name: Create archive
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.archive }}" = "zip" ]; then
|
||||||
|
zip croc_${{ github.event.release.name }}_${{ matrix.name }}.zip croc${{ matrix.ext }} LICENSE
|
||||||
|
else
|
||||||
|
tar -czvf croc_${{ github.event.release.name }}_${{ matrix.name }}.tar.gz croc${{ matrix.ext }} LICENSE
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: windows7-builds
|
name: build-${{ matrix.name }}
|
||||||
path: |
|
path: |
|
||||||
*Windows7*.zip
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [build, build-windows7]
|
needs: [prepare-source, build]
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
steps:
|
steps:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue