|
@@ -5,7 +5,7 @@ on:
|
|
|
tags: 'v*'
|
|
|
|
|
|
env:
|
|
|
- GO_VERSION: 1.18.5
|
|
|
+ GO_VERSION: 1.18.6
|
|
|
|
|
|
jobs:
|
|
|
prepare-sources-with-deps:
|
|
@@ -71,16 +71,16 @@ jobs:
|
|
|
|
|
|
- name: Build for macOS x86_64
|
|
|
if: startsWith(matrix.os, 'windows-') != true
|
|
|
- run: go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
+ run: go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --abbrev=8 --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
|
|
|
- name: Build for macOS arm64
|
|
|
if: startsWith(matrix.os, 'macos-') == true
|
|
|
- run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
|
|
|
+ run: CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 SDKROOT=$(xcrun --sdk macosx --show-sdk-path) go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --abbrev=8 --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo_arm64
|
|
|
|
|
|
- name: Build for Windows
|
|
|
if: startsWith(matrix.os, 'windows-')
|
|
|
run: |
|
|
|
- $GIT_COMMIT = (git describe --always --dirty) | Out-String
|
|
|
+ $GIT_COMMIT = (git describe --always --abbrev=8 --dirty) | Out-String
|
|
|
$DATE_TIME = ([datetime]::Now.ToUniversalTime().toString("yyyy-MM-ddTHH:mm:ssZ")) | Out-String
|
|
|
$FILE_VERSION = $Env:SFTPGO_VERSION.substring(1) + ".0"
|
|
|
go install github.com/tc-hib/go-winres@latest
|
|
@@ -254,11 +254,12 @@ jobs:
|
|
|
|
|
|
prepare-linux:
|
|
|
name: Prepare Linux binaries
|
|
|
- runs-on: ubuntu-18.04
|
|
|
+ runs-on: ubuntu-latest
|
|
|
strategy:
|
|
|
matrix:
|
|
|
include:
|
|
|
- arch: amd64
|
|
|
+ distro: ubuntu:18.04
|
|
|
go-arch: amd64
|
|
|
deb-arch: amd64
|
|
|
rpm-arch: x86_64
|
|
@@ -284,17 +285,13 @@ jobs:
|
|
|
|
|
|
steps:
|
|
|
- uses: actions/checkout@v3
|
|
|
- - name: Set up Go
|
|
|
- if: ${{ matrix.arch == 'amd64' }}
|
|
|
- uses: actions/setup-go@v3
|
|
|
- with:
|
|
|
- go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
- name: Get versions
|
|
|
id: get_version
|
|
|
run: |
|
|
|
echo ::set-output name=SFTPGO_VERSION::${GITHUB_REF/refs\/tags\//}
|
|
|
echo ::set-output name=GO_VERSION::${GO_VERSION}
|
|
|
+ echo ::set-output name=COMMIT::${GITHUB_SHA::8}
|
|
|
shell: bash
|
|
|
env:
|
|
|
GO_VERSION: ${{ env.GO_VERSION }}
|
|
@@ -302,7 +299,20 @@ jobs:
|
|
|
- name: Build on amd64
|
|
|
if: ${{ matrix.arch == 'amd64' }}
|
|
|
run: |
|
|
|
- go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
+ echo '#!/bin/bash' > build.sh
|
|
|
+ echo '' >> build.sh
|
|
|
+ echo 'set -e' >> build.sh
|
|
|
+ echo 'apt-get update -q -y' >> build.sh
|
|
|
+ echo 'apt-get install -q -y curl gcc' >> build.sh
|
|
|
+ echo 'curl --retry 5 --retry-delay 2 --connect-timeout 10 -o go.tar.gz -L https://go.dev/dl/go${{ steps.get_version.outputs.GO_VERSION }}.linux-${{ matrix.go-arch }}.tar.gz' >> build.sh
|
|
|
+ echo 'tar -C /usr/local -xzf go.tar.gz' >> build.sh
|
|
|
+ echo 'export PATH=$PATH:/usr/local/go/bin' >> build.sh
|
|
|
+ echo 'go version' >> build.sh
|
|
|
+ echo 'cd /usr/local/src' >> build.sh
|
|
|
+ echo 'go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=${{ steps.get_version.outputs.COMMIT }} -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo' >> build.sh
|
|
|
+
|
|
|
+ chmod 755 build.sh
|
|
|
+ docker run --rm --name ubuntu-build --mount type=bind,source=`pwd`,target=/usr/local/src ${{ matrix.distro }} /usr/local/src/build.sh
|
|
|
mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
|
|
|
echo "For documentation please take a look here:" > output/README.txt
|
|
|
echo "" >> output/README.txt
|
|
@@ -326,12 +336,6 @@ jobs:
|
|
|
env:
|
|
|
SFTPGO_VERSION: ${{ steps.get_version.outputs.SFTPGO_VERSION }}
|
|
|
|
|
|
- - name: Get commit SHA
|
|
|
- if: ${{ matrix.arch != 'amd64' }}
|
|
|
- id: get_commit
|
|
|
- run: echo ::set-output name=COMMIT::${GITHUB_SHA::8}
|
|
|
- shell: bash
|
|
|
-
|
|
|
- uses: uraimo/run-on-arch-action@v2
|
|
|
if: ${{ matrix.arch != 'amd64' }}
|
|
|
name: Build for ${{ matrix.arch }}
|
|
@@ -356,7 +360,8 @@ jobs:
|
|
|
tar -C /usr/local -xzf go.tar.gz
|
|
|
run: |
|
|
|
export PATH=$PATH:/usr/local/go/bin
|
|
|
- go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=${{ steps.get_commit.outputs.COMMIT }} -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
+ go version
|
|
|
+ go build -buildvcs=false -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=${{ steps.get_version.outputs.COMMIT }} -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo
|
|
|
mkdir -p output/{init,sqlite,bash_completion,zsh_completion}
|
|
|
echo "For documentation please take a look here:" > output/README.txt
|
|
|
echo "" >> output/README.txt
|