build: streamline gathering of facts, checkouts (#10158)
This commit is contained in:
@@ -37,6 +37,51 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Source
|
||||||
|
#
|
||||||
|
|
||||||
|
facts:
|
||||||
|
name: Gather common facts
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.get-version.outputs.version }}
|
||||||
|
release-kind: ${{ steps.get-version.outputs.release-kind }}
|
||||||
|
go-version: ${{ steps.get-go.outputs.go-version }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
||||||
|
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
cache: false
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Get Syncthing version
|
||||||
|
id: get-version
|
||||||
|
run: |
|
||||||
|
version=$(go run build.go version)
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Version: $version"
|
||||||
|
|
||||||
|
kind=stable
|
||||||
|
if [[ $version == *-rc.[0-9] || $version == *-rc.[0-9][0-9] ]] ; then
|
||||||
|
kind=candidate
|
||||||
|
elif [[ $version == *-* ]] ; then
|
||||||
|
kind=nightly
|
||||||
|
fi
|
||||||
|
echo "release-kind=$kind" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Release kind: $kind"
|
||||||
|
|
||||||
|
- name: Get Go version
|
||||||
|
id: get-go
|
||||||
|
run: |
|
||||||
|
go version
|
||||||
|
echo "go-version=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tests for all platforms. Runs a matrix build on Windows, Linux and Mac,
|
# Tests for all platforms. Runs a matrix build on Windows, Linux and Mac,
|
||||||
# with the list of expected supported Go versions (current, previous).
|
# with the list of expected supported Go versions (current, previous).
|
||||||
@@ -123,17 +168,18 @@ jobs:
|
|||||||
package-windows:
|
package-windows:
|
||||||
name: Package for Windows
|
name: Package for Windows
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- uses: mlugg/setup-zig@v2
|
- uses: mlugg/setup-zig@v2
|
||||||
|
|
||||||
@@ -142,7 +188,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod
|
~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-package-windows-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-package-windows-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -231,22 +277,18 @@ jobs:
|
|||||||
package-linux:
|
package-linux:
|
||||||
name: Package for Linux
|
name: Package for Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Get actual Go version
|
|
||||||
run: |
|
|
||||||
go version
|
|
||||||
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- uses: mlugg/setup-zig@v2
|
- uses: mlugg/setup-zig@v2
|
||||||
|
|
||||||
@@ -255,7 +297,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod
|
~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-package-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-package-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Create packages
|
- name: Create packages
|
||||||
run: |
|
run: |
|
||||||
@@ -297,32 +339,27 @@ jobs:
|
|||||||
name: Package for macOS
|
name: Package for macOS
|
||||||
if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release-nightly' || startsWith(github.ref, 'refs/tags/v'))
|
if: github.repository_owner == 'syncthing' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release-nightly' || startsWith(github.ref, 'refs/tags/v'))
|
||||||
environment: release
|
environment: release
|
||||||
|
runs-on: macos-latest
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
env:
|
env:
|
||||||
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
|
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
|
||||||
runs-on: macos-latest
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Get actual Go version
|
|
||||||
run: |
|
|
||||||
go version
|
|
||||||
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod
|
~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-package-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-package-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Import signing certificate
|
- name: Import signing certificate
|
||||||
if: env.CODESIGN_IDENTITY != ''
|
if: env.CODESIGN_IDENTITY != ''
|
||||||
@@ -432,29 +469,25 @@ jobs:
|
|||||||
package-cross:
|
package-cross:
|
||||||
name: Package cross compiled
|
name: Package cross compiled
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Get actual Go version
|
|
||||||
run: |
|
|
||||||
go version
|
|
||||||
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod
|
~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-cross-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-cross-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Create packages
|
- name: Create packages
|
||||||
run: |
|
run: |
|
||||||
@@ -502,33 +535,33 @@ jobs:
|
|||||||
package-source:
|
package-source:
|
||||||
name: Package source code
|
name: Package source code
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Package source
|
- name: Package source
|
||||||
run: |
|
run: |
|
||||||
version=$(go run build.go version)
|
echo "$VERSION" > RELEASE
|
||||||
echo "$version" > RELEASE
|
|
||||||
|
|
||||||
go mod vendor
|
go mod vendor
|
||||||
go run build.go assets
|
go run build.go assets
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
tar c -z -f "syncthing-source-$version.tar.gz" \
|
tar c -z -f "syncthing-source-$VERSION.tar.gz" \
|
||||||
--exclude .git \
|
--exclude .git \
|
||||||
syncthing
|
syncthing
|
||||||
|
|
||||||
mv "syncthing-source-$version.tar.gz" syncthing
|
mv "syncthing-source-$VERSION.tar.gz" syncthing
|
||||||
|
|
||||||
- name: Archive artifacts
|
- name: Archive artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -550,27 +583,26 @@ jobs:
|
|||||||
- package-macos
|
- package-macos
|
||||||
- package-cross
|
- package-cross
|
||||||
- package-source
|
- package-source
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: syncthing/release-tools
|
repository: syncthing/release-tools
|
||||||
path: tools
|
path: tools
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Install signing tool
|
- name: Install signing tool
|
||||||
run: |
|
run: |
|
||||||
@@ -597,9 +629,6 @@ jobs:
|
|||||||
sha256sum "${files[@]}" > sha256sum.txt
|
sha256sum "${files[@]}" > sha256sum.txt
|
||||||
popd
|
popd
|
||||||
|
|
||||||
version=$(go run build.go version)
|
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Sign shasum files
|
- name: Sign shasum files
|
||||||
uses: docker://ghcr.io/kastelo/ezapt:latest
|
uses: docker://ghcr.io/kastelo/ezapt:latest
|
||||||
with:
|
with:
|
||||||
@@ -635,22 +664,18 @@ jobs:
|
|||||||
package-debian:
|
package-debian:
|
||||||
name: Package for Debian
|
name: Package for Debian
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Get actual Go version
|
|
||||||
run: |
|
|
||||||
go version
|
|
||||||
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
@@ -667,7 +692,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod
|
~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-debian-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-debian-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Package for Debian (CGO)
|
- name: Package for Debian (CGO)
|
||||||
run: |
|
run: |
|
||||||
@@ -697,13 +722,13 @@ jobs:
|
|||||||
environment: release
|
environment: release
|
||||||
needs:
|
needs:
|
||||||
- sign-for-upgrade
|
- sign-for-upgrade
|
||||||
|
- facts
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: syncthing/release-tools
|
repository: syncthing/release-tools
|
||||||
path: tools
|
path: tools
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -713,9 +738,8 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Create release json
|
- name: Create release json
|
||||||
run: |
|
run: |
|
||||||
@@ -750,12 +774,13 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- sign-for-upgrade
|
- sign-for-upgrade
|
||||||
- package-debian
|
- package-debian
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- name: Download signed packages
|
- name: Download signed packages
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -771,14 +796,8 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
version=$(go run build.go version)
|
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Push to object store (${{ env.VERSION }})
|
- name: Push to object store (${{ env.VERSION }})
|
||||||
uses: docker://docker.io/rclone/rclone:latest
|
uses: docker://docker.io/rclone/rclone:latest
|
||||||
@@ -852,12 +871,13 @@ jobs:
|
|||||||
environment: release
|
environment: release
|
||||||
needs:
|
needs:
|
||||||
- package-debian
|
- package-debian
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- name: Download packages
|
- name: Download packages
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
@@ -865,24 +885,11 @@ jobs:
|
|||||||
name: debian-packages
|
name: debian-packages
|
||||||
path: packages
|
path: packages
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
version=$(go run build.go version)
|
|
||||||
echo "Version: $version"
|
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Decide whether packages should go to stable, candidate or nightly
|
# Decide whether packages should go to stable, candidate or nightly
|
||||||
- name: Prepare packages
|
- name: Prepare packages
|
||||||
run: |
|
run: |
|
||||||
kind=stable
|
mkdir -p packages/syncthing/$RELEASE_KIND
|
||||||
if [[ $VERSION == *-rc.[0-9] || $VERSION == *-rc.[0-9][0-9] ]] ; then
|
mv packages/*.deb packages/syncthing/$RELEASE_KIND
|
||||||
kind=candidate
|
|
||||||
elif [[ $VERSION == *-* ]] ; then
|
|
||||||
kind=nightly
|
|
||||||
fi
|
|
||||||
echo "Kind: $kind"
|
|
||||||
mkdir -p packages/syncthing/$kind
|
|
||||||
mv packages/*.deb packages/syncthing/$kind
|
|
||||||
|
|
||||||
- name: Pull archive
|
- name: Pull archive
|
||||||
uses: docker://docker.io/rclone/rclone:latest
|
uses: docker://docker.io/rclone/rclone:latest
|
||||||
@@ -930,6 +937,11 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
|
env:
|
||||||
|
VERSION: ${{ needs.facts.outputs.version }}
|
||||||
|
RELEASE_KIND: ${{ needs.facts.outputs.release-kind }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
pkg:
|
pkg:
|
||||||
@@ -948,20 +960,11 @@ jobs:
|
|||||||
image: discosrv
|
image: discosrv
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.ref }} # https://github.com/actions/checkout/issues/882
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Get actual Go version
|
|
||||||
run: |
|
|
||||||
go version
|
|
||||||
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- uses: mlugg/setup-zig@v2
|
- uses: mlugg/setup-zig@v2
|
||||||
|
|
||||||
@@ -970,7 +973,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
~/go/pkg/mod
|
~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-docker-${{ matrix.pkg }}-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ needs.facts.outputs.go-version }}-docker-${{ matrix.pkg }}-${{ hashFiles('**/go.sum') }}
|
||||||
|
|
||||||
- name: Build binaries (CGO)
|
- name: Build binaries (CGO)
|
||||||
run: |
|
run: |
|
||||||
@@ -1002,8 +1005,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Set version tags
|
- name: Set version tags
|
||||||
run: |
|
run: |
|
||||||
version=$(go run build.go version)
|
version=${VERSION#v}
|
||||||
version=${version#v}
|
|
||||||
repo=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
|
repo=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
|
||||||
ref="${{github.ref_name}}"
|
ref="${{github.ref_name}}"
|
||||||
ref=${ref//\//-} # slashes to dashes
|
ref=${ref//\//-} # slashes to dashes
|
||||||
@@ -1022,9 +1024,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo Pushing to $tags
|
echo Pushing to $tags
|
||||||
|
|
||||||
echo "DOCKER_TAGS=$tags" >> $GITHUB_ENV
|
echo "DOCKER_TAGS=$tags" >> $GITHUB_ENV
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
@@ -1069,14 +1069,15 @@ jobs:
|
|||||||
govulncheck:
|
govulncheck:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Run govulncheck
|
name: Run govulncheck
|
||||||
|
needs:
|
||||||
|
- facts
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ needs.facts.outputs.go-version }}
|
||||||
cache: false
|
cache: false
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: run govulncheck
|
- name: run govulncheck
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -922,6 +922,9 @@ func rmr(paths ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getReleaseVersion() (string, error) {
|
func getReleaseVersion() (string, error) {
|
||||||
|
if ver := os.Getenv("VERSION"); ver != "" {
|
||||||
|
return strings.TrimSpace(ver), nil
|
||||||
|
}
|
||||||
bs, err := os.ReadFile("RELEASE")
|
bs, err := os.ReadFile("RELEASE")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -966,7 +969,7 @@ func getGitVersion() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getVersion() string {
|
func getVersion() string {
|
||||||
// First try for a RELEASE file,
|
// First try for a RELEASE file or $VERSION env var,
|
||||||
if ver, err := getReleaseVersion(); err == nil {
|
if ver, err := getReleaseVersion(); err == nil {
|
||||||
return ver
|
return ver
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user