From 2d198174318b5d42a88f452b870e608f9a9b1987 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 3 Sep 2022 19:02:33 +0200 Subject: [PATCH] CI: improve workflows Signed-off-by: Nicola Murino --- .github/workflows/development.yml | 10 ++++++++-- .github/workflows/docker.yml | 7 +++++++ .github/workflows/release.yml | 10 ++++++++-- openapi/openapi.yaml | 2 +- version/version.go | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index a8215e70..01cfe0da 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -412,6 +412,12 @@ jobs: gzip output/man/man1/* cp sftpgo output/ + - 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 }} @@ -426,7 +432,7 @@ jobs: shell: /bin/bash install: | apt-get update -q -y - apt-get install -q -y curl gcc git + apt-get install -q -y curl gcc if [ ${{ matrix.go }} == 'latest' ] then GO_VERSION=$(curl -L https://go.dev/VERSION?m=text) @@ -446,7 +452,7 @@ jobs: then export GOARM=7 fi - go build -buildvcs=false -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 + 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 mkdir -p output/{init,bash_completion,zsh_completion} cp sftpgo.json output/ cp -r templates output/ diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d784e02d..6777d594 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -95,6 +95,13 @@ jobs: fi TAGS="${TAGS},${DOCKER_IMAGE}:distroless" TAGS_SLIM="${TAGS_SLIM},${DOCKER_IMAGE}:distroless-slim" + elif [[ $DOCKER_PKG == debian-plugins ]]; then + if [[ -n $MAJOR && -n $MINOR ]]; then + TAGS="${TAGS},${DOCKER_IMAGE}:${MINOR}-plugins,${DOCKER_IMAGE}:${MAJOR}-plugins" + TAGS_SLIM="${TAGS_SLIM},${DOCKER_IMAGE}:${MINOR}-plugins-slim,${DOCKER_IMAGE}:${MAJOR}-plugins-slim" + fi + TAGS="${TAGS},${DOCKER_IMAGE}:plugins" + TAGS_SLIM="${TAGS_SLIM},${DOCKER_IMAGE}:plugins-slim" else if [[ -n $MAJOR && -n $MINOR ]]; then TAGS="${TAGS},${DOCKER_IMAGE}:${MINOR}-alpine,${DOCKER_IMAGE}:${MAJOR}-alpine" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e9890b6..b8627ec7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -326,6 +326,12 @@ 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 }} @@ -340,7 +346,7 @@ jobs: shell: /bin/bash install: | apt-get update -q -y - apt-get install -q -y curl gcc git xz-utils + apt-get install -q -y curl gcc xz-utils GO_DOWNLOAD_ARCH=${{ matrix.go-arch }} if [ ${{ matrix.arch}} == 'armv7' ] then @@ -350,7 +356,7 @@ 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=`git describe --always --dirty` -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -o sftpgo + 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 mkdir -p output/{init,sqlite,bash_completion,zsh_completion} echo "For documentation please take a look here:" > output/README.txt echo "" >> output/README.txt diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 5cecb8ab..ee0aee6b 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -26,7 +26,7 @@ info: SFTPGo supports groups to simplify the administration of multiple accounts by letting you assign settings once to a group, instead of multiple times to each individual user. The SFTPGo WebClient allows end users to change their credentials, browse and manage their files in the browser and setup two-factor authentication which works with Authy, Google Authenticator and other compatible apps. From the WebClient each authorized user can also create HTTP/S links to externally share files and folders securely, by setting limits to the number of downloads/uploads, protecting the share with a password, limiting access by source IP address, setting an automatic expiration date. - version: 2.3.4 + version: 2.3.4-dev contact: name: API support url: 'https://github.com/drakkan/sftpgo' diff --git a/version/version.go b/version/version.go index 9818c242..a2d0e35a 100644 --- a/version/version.go +++ b/version/version.go @@ -17,7 +17,7 @@ package version import "strings" -const version = "2.3.4" +const version = "2.3.4-dev" var ( commit = ""