2022-11-05 14:40:53 +00:00
|
|
|
name: Build Syncthing
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
2023-07-30 12:24:17 +00:00
|
|
|
schedule:
|
|
|
|
# Run nightly build at 05:00 UTC
|
|
|
|
- cron: '00 05 * * *'
|
2023-08-09 08:50:07 +00:00
|
|
|
workflow_dispatch:
|
2022-11-05 14:40:53 +00:00
|
|
|
|
|
|
|
env:
|
2023-06-14 07:37:59 +00:00
|
|
|
# The go version to use for builds. We set check-latest to true when
|
|
|
|
# installing, so we get the latest patch version that matches the
|
|
|
|
# expression.
|
2024-05-08 06:01:46 +00:00
|
|
|
GO_VERSION: "~1.22.3"
|
2022-11-05 14:40:53 +00:00
|
|
|
|
|
|
|
# Optimize compatibility on the slow archictures.
|
|
|
|
GO386: softfloat
|
|
|
|
GOARM: "5"
|
|
|
|
GOMIPS: softfloat
|
|
|
|
|
|
|
|
# Avoid hilarious amounts of obscuring log output when running tests.
|
|
|
|
LOGGER_DISCARD: "1"
|
|
|
|
|
2022-11-25 12:52:48 +00:00
|
|
|
# Our build metadata
|
|
|
|
BUILD_USER: builder
|
|
|
|
BUILD_HOST: github.syncthing.net
|
|
|
|
|
2022-11-05 14:40:53 +00:00
|
|
|
# A note on actions and third party code... The actions under actions/ (like
|
|
|
|
# `uses: actions/checkout`) are maintained by GitHub, and we need to trust
|
|
|
|
# GitHub to maintain their code and infrastructure or we're in deep shit in
|
|
|
|
# general. The same doesn't necessarily apply to other actions authors, so
|
|
|
|
# some care needs to be taken when adding steps, especially in the paths
|
|
|
|
# that lead up to code being packaged and signed.
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
#
|
2023-02-22 09:51:49 +00:00
|
|
|
# Tests for all platforms. Runs a matrix build on Windows, Linux and Mac,
|
|
|
|
# with the list of expected supported Go versions (current, previous).
|
2022-11-05 14:40:53 +00:00
|
|
|
#
|
|
|
|
|
2023-02-22 09:51:49 +00:00
|
|
|
build-test:
|
|
|
|
name: Build and test
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
runner: ["windows-latest", "ubuntu-latest", "macos-latest"]
|
|
|
|
# The oldest version in this list should match what we have in our go.mod.
|
|
|
|
# Variables don't seem to be supported here, or we could have done something nice.
|
2024-05-08 06:01:46 +00:00
|
|
|
go: ["~1.21.7", "~1.22.3"]
|
2023-02-22 09:51:49 +00:00
|
|
|
runs-on: ${{ matrix.runner }}
|
2022-11-05 14:40:53 +00:00
|
|
|
steps:
|
|
|
|
- name: Set git to use LF
|
2023-02-22 09:51:49 +00:00
|
|
|
if: matrix.runner == 'windows-latest'
|
|
|
|
# Without this, the Windows checkout will happen with CRLF line
|
|
|
|
# endings, which is fine for the source code but messes up tests
|
|
|
|
# that depend on data on disk being as expected. Ideally, those
|
|
|
|
# tests should be fixed, but not today.
|
2022-11-05 14:40:53 +00:00
|
|
|
run: |
|
|
|
|
git config --global core.autocrlf false
|
|
|
|
git config --global core.eol lf
|
|
|
|
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-11-05 14:40:53 +00:00
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2022-11-05 14:40:53 +00:00
|
|
|
with:
|
2023-02-22 09:51:49 +00:00
|
|
|
go-version: ${{ matrix.go }}
|
2022-11-05 14:40:53 +00:00
|
|
|
cache: true
|
2023-06-14 07:37:59 +00:00
|
|
|
check-latest: true
|
2022-11-05 14:40:53 +00:00
|
|
|
|
2023-02-22 09:51:49 +00:00
|
|
|
- name: Build
|
2022-11-05 14:40:53 +00:00
|
|
|
run: |
|
|
|
|
go run build.go
|
2023-02-22 09:51:49 +00:00
|
|
|
|
2023-07-30 09:43:10 +00:00
|
|
|
- name: Install go-test-json-to-loki
|
|
|
|
run: |
|
|
|
|
go install calmh.dev/go-test-json-to-loki@latest
|
|
|
|
|
2023-02-22 09:51:49 +00:00
|
|
|
- name: Test
|
|
|
|
run: |
|
2023-11-13 09:52:59 +00:00
|
|
|
go version
|
2023-07-30 09:43:10 +00:00
|
|
|
go run build.go test | go-test-json-to-loki
|
|
|
|
env:
|
|
|
|
GOFLAGS: "-json"
|
2023-10-16 09:07:37 +00:00
|
|
|
LOKI_URL: ${{ vars.LOKI_URL }}
|
|
|
|
LOKI_USER: ${{ vars.LOKI_USER }}
|
2023-07-30 09:43:10 +00:00
|
|
|
LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }}
|
|
|
|
LOKI_LABELS: "go=${{ matrix.go }},runner=${{ matrix.runner }},repo=${{ github.repository }},ref=${{ github.ref }}"
|
2022-11-05 14:40:53 +00:00
|
|
|
|
|
|
|
#
|
2023-02-22 09:51:49 +00:00
|
|
|
# Meta checks for formatting, copyright, etc
|
|
|
|
#
|
|
|
|
|
|
|
|
correctness:
|
|
|
|
name: Check correctness
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2023-02-22 09:51:49 +00:00
|
|
|
|
|
|
|
- name: Check correctness
|
|
|
|
run: |
|
|
|
|
go test -v ./meta
|
|
|
|
|
2023-06-01 10:04:14 +00:00
|
|
|
#
|
|
|
|
# The basic checks job is a virtual one that depends on the matrix tests,
|
|
|
|
# the correctness checks, and various builds that we always do. This makes
|
|
|
|
# it easy to have the PR process have a single test as a gatekeeper for
|
|
|
|
# merging, instead of having to add all the matrix tests and update them
|
|
|
|
# each time the version changes. (The top level test is not available for
|
|
|
|
# choosing there, only the matrix "children".)
|
|
|
|
#
|
|
|
|
|
|
|
|
basics:
|
|
|
|
name: Basic checks passed
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build-test
|
|
|
|
- correctness
|
|
|
|
- package-linux
|
|
|
|
- package-cross
|
|
|
|
- package-source
|
|
|
|
- package-debian
|
2023-07-20 05:05:35 +00:00
|
|
|
- govulncheck
|
2023-06-01 10:04:14 +00:00
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-01 10:04:14 +00:00
|
|
|
|
2023-02-22 09:51:49 +00:00
|
|
|
#
|
|
|
|
# Windows
|
2022-11-05 14:40:53 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
package-windows:
|
2023-02-22 09:51:49 +00:00
|
|
|
name: Package for Windows
|
2023-10-03 07:33:52 +00:00
|
|
|
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/heads/release-'))
|
2022-11-05 14:40:53 +00:00
|
|
|
environment: signing
|
2023-02-22 09:51:49 +00:00
|
|
|
runs-on: windows-latest
|
2022-11-05 14:40:53 +00:00
|
|
|
steps:
|
|
|
|
- name: Set git to use LF
|
2023-02-22 09:51:49 +00:00
|
|
|
# Without this, the checkout will happen with CRLF line endings,
|
|
|
|
# which is fine for the source code but messes up tests that depend
|
|
|
|
# on data on disk being as expected. Ideally, those tests should be
|
|
|
|
# fixed, but not today.
|
2022-11-05 14:40:53 +00:00
|
|
|
run: |
|
|
|
|
git config --global core.autocrlf false
|
|
|
|
git config --global core.eol lf
|
|
|
|
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2022-11-05 14:40:53 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2022-11-05 14:40:53 +00:00
|
|
|
with:
|
2023-12-06 08:02:12 +00:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2022-11-05 14:40:53 +00:00
|
|
|
|
2023-11-13 11:20:40 +00:00
|
|
|
- name: Get actual Go version
|
|
|
|
run: |
|
|
|
|
go version
|
|
|
|
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
|
|
|
2024-01-31 07:33:02 +00:00
|
|
|
- uses: actions/cache@v4
|
2022-11-05 14:40:53 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~\AppData\Local\go-build
|
|
|
|
~\go\pkg\mod
|
2022-11-25 12:52:48 +00:00
|
|
|
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-package-${{ hashFiles('**/go.sum') }}
|
2022-11-05 14:40:53 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.4.0
|
|
|
|
|
|
|
|
- name: Create packages
|
|
|
|
run: |
|
|
|
|
go run build.go -goarch amd64 zip
|
|
|
|
go run build.go -goarch arm zip
|
|
|
|
go run build.go -goarch arm64 zip
|
|
|
|
go run build.go -goarch 386 zip
|
|
|
|
env:
|
2023-02-22 09:51:49 +00:00
|
|
|
CGO_ENABLED: "0"
|
2022-11-05 14:40:53 +00:00
|
|
|
CODESIGN_SIGNTOOL: ${{ secrets.CODESIGN_SIGNTOOL }}
|
|
|
|
CODESIGN_CERTIFICATE_BASE64: ${{ secrets.CODESIGN_CERTIFICATE_BASE64 }}
|
|
|
|
CODESIGN_CERTIFICATE_PASSWORD: ${{ secrets.CODESIGN_CERTIFICATE_PASSWORD }}
|
|
|
|
CODESIGN_TIMESTAMP_SERVER: ${{ secrets.CODESIGN_TIMESTAMP_SERVER }}
|
|
|
|
|
|
|
|
- name: Archive artifacts
|
2024-01-01 10:08:55 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-11-05 14:40:53 +00:00
|
|
|
with:
|
2023-04-28 08:49:20 +00:00
|
|
|
name: packages-windows
|
2022-11-05 14:40:53 +00:00
|
|
|
path: syncthing-windows-*.zip
|
2023-02-22 09:51:49 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Linux
|
|
|
|
#
|
|
|
|
|
|
|
|
package-linux:
|
|
|
|
name: Package for Linux
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2023-02-22 09:51:49 +00:00
|
|
|
|
2023-11-13 11:20:40 +00:00
|
|
|
- name: Get actual Go version
|
|
|
|
run: |
|
|
|
|
go version
|
|
|
|
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
|
|
|
2024-01-31 07:33:02 +00:00
|
|
|
- uses: actions/cache@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-package-${{ hashFiles('**/go.sum') }}
|
|
|
|
|
|
|
|
- name: Create packages
|
|
|
|
run: |
|
|
|
|
archs=$(go tool dist list | grep linux | sed 's#linux/##')
|
|
|
|
for goarch in $archs ; do
|
|
|
|
go run build.go -goarch "$goarch" tar
|
|
|
|
done
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: "0"
|
|
|
|
|
|
|
|
- name: Archive artifacts
|
2024-01-01 10:08:55 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
2023-04-28 08:49:20 +00:00
|
|
|
name: packages-linux
|
2023-02-22 09:51:49 +00:00
|
|
|
path: syncthing-linux-*.tar.gz
|
|
|
|
|
|
|
|
#
|
|
|
|
# macOS
|
|
|
|
#
|
|
|
|
|
|
|
|
package-macos:
|
|
|
|
name: Package for macOS
|
2023-10-03 07:33:52 +00:00
|
|
|
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/heads/release-'))
|
2023-02-22 09:51:49 +00:00
|
|
|
environment: signing
|
|
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2023-02-22 09:51:49 +00:00
|
|
|
|
2023-11-13 11:20:40 +00:00
|
|
|
- name: Get actual Go version
|
|
|
|
run: |
|
|
|
|
go version
|
|
|
|
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
|
|
|
2024-01-31 07:33:02 +00:00
|
|
|
- uses: actions/cache@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-package-${{ hashFiles('**/go.sum') }}
|
|
|
|
|
|
|
|
- name: Import signing certificate
|
|
|
|
run: |
|
|
|
|
# Set up a run-specific keychain, making it available for the
|
|
|
|
# `codesign` tool.
|
|
|
|
umask 066
|
|
|
|
KEYCHAIN_PATH=$RUNNER_TEMP/codesign.keychain
|
|
|
|
KEYCHAIN_PASSWORD=$(uuidgen)
|
|
|
|
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
|
|
|
security default-keychain -s "$KEYCHAIN_PATH"
|
|
|
|
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
|
|
|
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
|
|
|
|
|
|
|
|
# Import the certificate
|
|
|
|
CERTIFICATE_PATH=$RUNNER_TEMP/codesign.p12
|
|
|
|
echo "$DEVELOPER_ID_CERTIFICATE_BASE64" | base64 -d -o "$CERTIFICATE_PATH"
|
|
|
|
security import "$CERTIFICATE_PATH" -k "$KEYCHAIN_PATH" -P "$DEVELOPER_ID_CERTIFICATE_PASSWORD" -T /usr/bin/codesign -T /usr/bin/productsign
|
|
|
|
security set-key-partition-list -S apple-tool:,apple: -s -k actions "$KEYCHAIN_PATH"
|
|
|
|
|
|
|
|
# Set the codesign identity for following steps
|
|
|
|
echo "CODESIGN_IDENTITY=$CODESIGN_IDENTITY" >> $GITHUB_ENV
|
|
|
|
env:
|
|
|
|
DEVELOPER_ID_CERTIFICATE_BASE64: ${{ secrets.DEVELOPER_ID_CERTIFICATE_BASE64 }}
|
|
|
|
DEVELOPER_ID_CERTIFICATE_PASSWORD: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }}
|
|
|
|
CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }}
|
|
|
|
|
|
|
|
- name: Create package (amd64)
|
|
|
|
run: |
|
|
|
|
go run build.go -goarch amd64 zip
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: "1"
|
|
|
|
|
|
|
|
- name: Create package (arm64 cross)
|
|
|
|
run: |
|
|
|
|
cat <<EOT > xgo.sh
|
|
|
|
#!/bin/bash
|
|
|
|
CGO_ENABLED=1 \
|
|
|
|
CGO_CFLAGS="-target arm64-apple-macos10.15" \
|
|
|
|
CGO_LDFLAGS="-target arm64-apple-macos10.15" \
|
|
|
|
go "\$@"
|
|
|
|
EOT
|
|
|
|
chmod 755 xgo.sh
|
|
|
|
go run build.go -gocmd ./xgo.sh -goarch arm64 zip
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: "1"
|
|
|
|
|
|
|
|
- name: Create package (universal)
|
|
|
|
run: |
|
|
|
|
rm -rf _tmp
|
|
|
|
mkdir _tmp
|
|
|
|
pushd _tmp
|
|
|
|
|
|
|
|
unzip ../syncthing-macos-amd64-*.zip
|
|
|
|
unzip ../syncthing-macos-arm64-*.zip
|
|
|
|
lipo -create syncthing-macos-amd64-*/syncthing syncthing-macos-arm64-*/syncthing -o syncthing
|
|
|
|
|
|
|
|
amd64=(syncthing-macos-amd64-*)
|
|
|
|
universal="${amd64/amd64/universal}"
|
|
|
|
mv "$amd64" "$universal"
|
|
|
|
mv syncthing "$universal"
|
|
|
|
zip -r "../$universal.zip" "$universal"
|
|
|
|
|
|
|
|
- name: Archive artifacts
|
2024-01-01 10:08:55 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
2023-04-28 08:49:20 +00:00
|
|
|
name: packages-macos
|
2023-02-22 09:51:49 +00:00
|
|
|
path: syncthing-*.zip
|
|
|
|
|
2023-04-28 08:49:20 +00:00
|
|
|
notarize-macos:
|
|
|
|
name: Notarize for macOS
|
2023-10-03 07:33:52 +00:00
|
|
|
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/heads/release-'))
|
2023-04-28 08:49:20 +00:00
|
|
|
environment: signing
|
|
|
|
needs:
|
|
|
|
- package-macos
|
2023-06-01 10:04:14 +00:00
|
|
|
- basics
|
2023-04-28 08:49:20 +00:00
|
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
|
|
- name: Download artifacts
|
2024-01-01 10:09:23 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2023-04-28 08:49:20 +00:00
|
|
|
with:
|
|
|
|
name: packages-macos
|
|
|
|
|
|
|
|
- name: Notarize binaries
|
|
|
|
run: |
|
|
|
|
APPSTORECONNECT_API_KEY_PATH="$RUNNER_TEMP/apikey.p8"
|
|
|
|
echo "$APPSTORECONNECT_API_KEY" | base64 -d -o "$APPSTORECONNECT_API_KEY_PATH"
|
|
|
|
for file in syncthing-macos-*.zip ; do
|
|
|
|
xcrun notarytool submit \
|
|
|
|
-k "$APPSTORECONNECT_API_KEY_PATH" \
|
|
|
|
-d "$APPSTORECONNECT_API_KEY_ID" \
|
|
|
|
-i "$APPSTORECONNECT_API_KEY_ISSUER" \
|
|
|
|
$file
|
|
|
|
done
|
|
|
|
env:
|
|
|
|
APPSTORECONNECT_API_KEY: ${{ secrets.APPSTORECONNECT_API_KEY }}
|
|
|
|
APPSTORECONNECT_API_KEY_ID: ${{ secrets.APPSTORECONNECT_API_KEY_ID }}
|
|
|
|
APPSTORECONNECT_API_KEY_ISSUER: ${{ secrets.APPSTORECONNECT_API_KEY_ISSUER }}
|
|
|
|
|
2023-02-22 09:51:49 +00:00
|
|
|
#
|
|
|
|
# Cross compile other unixes
|
|
|
|
#
|
|
|
|
|
|
|
|
package-cross:
|
|
|
|
name: Package cross compiled
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2023-02-22 09:51:49 +00:00
|
|
|
|
2023-11-13 11:20:40 +00:00
|
|
|
- name: Get actual Go version
|
|
|
|
run: |
|
|
|
|
go version
|
|
|
|
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
|
|
|
2024-01-31 07:33:02 +00:00
|
|
|
- uses: actions/cache@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-cross-${{ hashFiles('**/go.sum') }}
|
|
|
|
|
|
|
|
- name: Create packages
|
|
|
|
run: |
|
|
|
|
platforms=$(go tool dist list \
|
|
|
|
| grep -v aix/ppc64 \
|
|
|
|
| grep -v android/ \
|
|
|
|
| grep -v darwin/ \
|
|
|
|
| grep -v ios/ \
|
|
|
|
| grep -v js/ \
|
|
|
|
| grep -v linux/ \
|
|
|
|
| grep -v nacl/ \
|
|
|
|
| grep -v plan9/ \
|
|
|
|
| grep -v windows/ \
|
2023-08-09 09:02:43 +00:00
|
|
|
| grep -v /wasm \
|
2023-02-22 09:51:49 +00:00
|
|
|
)
|
|
|
|
|
2023-09-01 06:35:30 +00:00
|
|
|
# Build for each platform with errors silenced, because we expect
|
|
|
|
# some oddball platforms to fail. This avoids a bunch of errors in
|
|
|
|
# the GitHub Actions output, instead summarizing each build
|
|
|
|
# failure as a warning.
|
2023-02-22 09:51:49 +00:00
|
|
|
for plat in $platforms; do
|
|
|
|
goos="${plat%/*}"
|
|
|
|
goarch="${plat#*/}"
|
2023-09-01 06:35:30 +00:00
|
|
|
echo "::group ::$plat"
|
|
|
|
if ! go run build.go -goos "$goos" -goarch "$goarch" tar 2>/dev/null; then
|
|
|
|
echo "::warning ::Failed to build for $plat"
|
2023-05-03 08:54:28 +00:00
|
|
|
fi
|
2023-09-01 06:35:30 +00:00
|
|
|
echo "::endgroup::"
|
2023-02-22 09:51:49 +00:00
|
|
|
done
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: "0"
|
|
|
|
|
|
|
|
- name: Archive artifacts
|
2024-01-01 10:08:55 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
2023-04-28 08:49:20 +00:00
|
|
|
name: packages-other
|
2023-02-22 09:51:49 +00:00
|
|
|
path: syncthing-*.tar.gz
|
|
|
|
|
|
|
|
#
|
|
|
|
# Source
|
|
|
|
#
|
|
|
|
|
|
|
|
package-source:
|
|
|
|
name: Package source code
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2023-02-22 09:51:49 +00:00
|
|
|
|
|
|
|
- name: Package source
|
|
|
|
run: |
|
|
|
|
version=$(go run build.go version)
|
|
|
|
echo "$version" > RELEASE
|
|
|
|
|
|
|
|
go mod vendor
|
|
|
|
go run build.go assets
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
tar c -z -f "syncthing-source-$version.tar.gz" \
|
|
|
|
--exclude .git \
|
|
|
|
syncthing
|
|
|
|
|
|
|
|
mv "syncthing-source-$version.tar.gz" syncthing
|
|
|
|
|
|
|
|
- name: Archive artifacts
|
2024-01-01 10:08:55 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-02-22 09:51:49 +00:00
|
|
|
with:
|
2023-04-28 08:49:20 +00:00
|
|
|
name: packages-source
|
2023-02-22 09:51:49 +00:00
|
|
|
path: syncthing-source-*.tar.gz
|
2023-04-28 09:24:41 +00:00
|
|
|
|
|
|
|
#
|
2023-06-06 10:53:10 +00:00
|
|
|
# Sign binaries for auto upgrade, generate ASC signature files
|
2023-04-28 09:24:41 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
sign-for-upgrade:
|
|
|
|
name: Sign for upgrade
|
2023-10-03 07:33:52 +00:00
|
|
|
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/heads/release-'))
|
2023-04-28 09:24:41 +00:00
|
|
|
environment: signing
|
|
|
|
needs:
|
2023-06-01 10:04:14 +00:00
|
|
|
- basics
|
2023-04-28 09:24:41 +00:00
|
|
|
- package-windows
|
|
|
|
- package-linux
|
|
|
|
- package-macos
|
|
|
|
- package-cross
|
2023-06-06 10:53:10 +00:00
|
|
|
- package-source
|
2023-04-28 09:24:41 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 09:24:41 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 09:24:41 +00:00
|
|
|
with:
|
|
|
|
repository: syncthing/release-tools
|
|
|
|
path: tools
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Download artifacts
|
2024-01-01 10:09:23 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2023-04-28 09:24:41 +00:00
|
|
|
|
2024-02-11 08:24:00 +00:00
|
|
|
- uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: false
|
|
|
|
check-latest: true
|
|
|
|
|
2023-04-28 09:24:41 +00:00
|
|
|
- name: Install signing tool
|
|
|
|
run: |
|
|
|
|
go install ./cmd/stsigtool
|
|
|
|
|
|
|
|
- name: Sign archives
|
|
|
|
run: |
|
|
|
|
export PRIVATE_KEY="$RUNNER_TEMP/privkey.pem"
|
|
|
|
export PATH="$PATH:$(go env GOPATH)/bin"
|
|
|
|
echo "$STSIGTOOL_PRIVATE_KEY" | base64 -d > "$PRIVATE_KEY"
|
|
|
|
mkdir packages
|
|
|
|
mv packages-*/* packages
|
|
|
|
pushd packages
|
|
|
|
"$GITHUB_WORKSPACE/tools/sign-only"
|
2023-06-06 10:53:10 +00:00
|
|
|
rm -f "$PRIVATE_KEY"
|
2023-04-28 09:24:41 +00:00
|
|
|
env:
|
|
|
|
STSIGTOOL_PRIVATE_KEY: ${{ secrets.STSIGTOOL_PRIVATE_KEY }}
|
|
|
|
|
2023-06-06 10:53:10 +00:00
|
|
|
- name: Create and sign .asc files
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
sudo apt -y install gnupg
|
|
|
|
|
|
|
|
export SIGNING_KEY="$RUNNER_TEMP/gpg-secret.asc"
|
|
|
|
echo "$GNUPG_SIGNING_KEY_BASE64" | base64 -d > "$SIGNING_KEY"
|
|
|
|
gpg --import < "$SIGNING_KEY"
|
|
|
|
|
|
|
|
pushd packages
|
|
|
|
files=(*.tar.gz *.zip)
|
|
|
|
sha1sum "${files[@]}" | gpg --clearsign > sha1sum.txt.asc
|
|
|
|
sha256sum "${files[@]}" | gpg --clearsign > sha256sum.txt.asc
|
|
|
|
gpg --sign --armour --detach syncthing-source-*.tar.gz
|
|
|
|
popd
|
|
|
|
rm -f "$SIGNING_KEY" .gnupg
|
|
|
|
env:
|
|
|
|
GNUPG_SIGNING_KEY_BASE64: ${{ secrets.GNUPG_SIGNING_KEY_BASE64 }}
|
|
|
|
|
2023-04-28 09:24:41 +00:00
|
|
|
- name: Archive artifacts
|
2024-01-01 10:08:55 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-28 09:24:41 +00:00
|
|
|
with:
|
|
|
|
name: packages-signed
|
|
|
|
path: packages/*
|
2023-05-01 07:30:16 +00:00
|
|
|
|
2023-04-28 11:10:10 +00:00
|
|
|
#
|
|
|
|
# Debian
|
|
|
|
#
|
|
|
|
|
|
|
|
package-debian:
|
|
|
|
name: Package for Debian
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-28 11:10:10 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-04-28 11:10:10 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2023-04-28 11:10:10 +00:00
|
|
|
|
2023-11-13 11:20:40 +00:00
|
|
|
- name: Get actual Go version
|
|
|
|
run: |
|
|
|
|
go version
|
|
|
|
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
|
|
|
2023-04-28 11:10:10 +00:00
|
|
|
- uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: '3.0'
|
|
|
|
|
|
|
|
- name: Install fpm
|
|
|
|
run: |
|
|
|
|
gem install fpm
|
|
|
|
|
2024-01-31 07:33:02 +00:00
|
|
|
- uses: actions/cache@v4
|
2023-04-28 11:10:10 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-debian-${{ hashFiles('**/go.sum') }}
|
|
|
|
|
|
|
|
- name: Package for Debian
|
|
|
|
run: |
|
2023-06-06 10:37:58 +00:00
|
|
|
for arch in amd64 i386 armhf armel arm64 ; do
|
|
|
|
go run build.go -no-upgrade -installsuffix=no-upgrade -goarch "$arch" deb
|
2023-04-28 11:10:10 +00:00
|
|
|
done
|
|
|
|
env:
|
|
|
|
BUILD_USER: debian
|
|
|
|
|
|
|
|
- name: Archive artifacts
|
2024-01-01 10:08:55 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-28 11:10:10 +00:00
|
|
|
with:
|
|
|
|
name: debian-packages
|
|
|
|
path: "*.deb"
|
2023-05-01 07:30:16 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Nightlies
|
|
|
|
#
|
|
|
|
|
|
|
|
publish-nightly:
|
|
|
|
name: Publish nightly build
|
2023-10-03 07:33:52 +00:00
|
|
|
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.ref, 'refs/heads/release-nightly')
|
2023-05-01 07:30:16 +00:00
|
|
|
environment: signing
|
|
|
|
needs:
|
|
|
|
- sign-for-upgrade
|
|
|
|
- notarize-macos
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-05-01 07:30:16 +00:00
|
|
|
with:
|
|
|
|
repository: syncthing/release-tools
|
|
|
|
path: tools
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Download artifacts
|
2024-01-01 10:09:23 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2023-05-01 07:30:16 +00:00
|
|
|
with:
|
|
|
|
name: packages-signed
|
|
|
|
path: packages
|
|
|
|
|
2024-02-11 08:24:00 +00:00
|
|
|
- uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: false
|
|
|
|
check-latest: true
|
|
|
|
|
2023-05-01 07:30:16 +00:00
|
|
|
- name: Create release json
|
|
|
|
run: |
|
|
|
|
cd packages
|
|
|
|
"$GITHUB_WORKSPACE/tools/generate-release-json" "$BASE_URL" > nightly.json
|
|
|
|
env:
|
|
|
|
BASE_URL: https://syncthing.ams3.digitaloceanspaces.com/nightly/
|
|
|
|
|
|
|
|
- name: Push artifacts
|
|
|
|
uses: docker://docker.io/rclone/rclone:latest
|
|
|
|
env:
|
|
|
|
RCLONE_CONFIG_SPACES_TYPE: s3
|
|
|
|
RCLONE_CONFIG_SPACES_PROVIDER: DigitalOcean
|
|
|
|
RCLONE_CONFIG_SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_KEY }}
|
|
|
|
RCLONE_CONFIG_SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET }}
|
|
|
|
RCLONE_CONFIG_SPACES_ENDPOINT: ams3.digitaloceanspaces.com
|
|
|
|
RCLONE_CONFIG_SPACES_ACL: public-read
|
|
|
|
with:
|
|
|
|
args: sync packages spaces:syncthing/nightly
|
2023-06-06 15:53:05 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Push release artifacts to Spaces
|
|
|
|
#
|
|
|
|
|
|
|
|
publish-release-files:
|
|
|
|
name: Publish release files
|
2023-10-03 07:33:52 +00:00
|
|
|
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/release'
|
2023-06-06 15:53:05 +00:00
|
|
|
environment: signing
|
|
|
|
needs:
|
|
|
|
- sign-for-upgrade
|
|
|
|
- package-debian
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-06 15:53:05 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Download signed packages
|
2024-01-01 10:09:23 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2023-06-06 15:53:05 +00:00
|
|
|
with:
|
|
|
|
name: packages-signed
|
|
|
|
path: packages
|
|
|
|
|
|
|
|
- name: Download debian packages
|
2024-01-01 10:09:23 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2023-06-06 15:53:05 +00:00
|
|
|
with:
|
|
|
|
name: debian-packages
|
|
|
|
path: packages
|
|
|
|
|
2024-02-11 08:24:00 +00:00
|
|
|
- uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: false
|
|
|
|
check-latest: true
|
|
|
|
|
2023-06-06 15:53:05 +00:00
|
|
|
- name: Set version
|
|
|
|
run: |
|
|
|
|
version=$(go run build.go version)
|
|
|
|
echo "VERSION=$version" >> $GITHUB_ENV
|
|
|
|
|
2023-07-04 08:27:26 +00:00
|
|
|
- name: Push to Spaces (${{ env.VERSION }})
|
2023-06-06 15:53:05 +00:00
|
|
|
uses: docker://docker.io/rclone/rclone:latest
|
|
|
|
env:
|
|
|
|
RCLONE_CONFIG_SPACES_TYPE: s3
|
|
|
|
RCLONE_CONFIG_SPACES_PROVIDER: DigitalOcean
|
|
|
|
RCLONE_CONFIG_SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_KEY }}
|
|
|
|
RCLONE_CONFIG_SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET }}
|
|
|
|
RCLONE_CONFIG_SPACES_ENDPOINT: ams3.digitaloceanspaces.com
|
|
|
|
RCLONE_CONFIG_SPACES_ACL: public-read
|
|
|
|
with:
|
|
|
|
args: sync packages spaces:syncthing/release/${{ env.VERSION }}
|
2023-06-14 07:23:52 +00:00
|
|
|
|
2023-07-04 08:27:26 +00:00
|
|
|
- name: Push to Spaces (latest)
|
|
|
|
uses: docker://docker.io/rclone/rclone:latest
|
|
|
|
env:
|
|
|
|
RCLONE_CONFIG_SPACES_TYPE: s3
|
|
|
|
RCLONE_CONFIG_SPACES_PROVIDER: DigitalOcean
|
|
|
|
RCLONE_CONFIG_SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_KEY }}
|
|
|
|
RCLONE_CONFIG_SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET }}
|
|
|
|
RCLONE_CONFIG_SPACES_ENDPOINT: ams3.digitaloceanspaces.com
|
|
|
|
RCLONE_CONFIG_SPACES_ACL: public-read
|
|
|
|
with:
|
|
|
|
args: sync spaces:syncthing/release/${{ env.VERSION }} spaces:syncthing/release/latest
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build and push to Docker Hub
|
|
|
|
#
|
|
|
|
|
2023-06-14 07:23:52 +00:00
|
|
|
docker-syncthing:
|
|
|
|
name: Build and push Docker images
|
|
|
|
runs-on: ubuntu-latest
|
2023-10-26 13:09:13 +00:00
|
|
|
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/release' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/infrastructure' || startsWith(github.ref, 'refs/heads/release-'))
|
2023-06-14 07:23:52 +00:00
|
|
|
environment: docker
|
2023-07-01 06:35:41 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
pkg:
|
|
|
|
- syncthing
|
|
|
|
- strelaysrv
|
|
|
|
- stdiscosrv
|
|
|
|
include:
|
|
|
|
- pkg: syncthing
|
|
|
|
dockerfile: Dockerfile
|
2023-07-03 10:08:53 +00:00
|
|
|
image: syncthing/syncthing
|
2023-07-01 06:35:41 +00:00
|
|
|
- pkg: strelaysrv
|
|
|
|
dockerfile: Dockerfile.strelaysrv
|
2023-07-03 10:08:53 +00:00
|
|
|
image: syncthing/relaysrv
|
2023-07-01 06:35:41 +00:00
|
|
|
- pkg: stdiscosrv
|
|
|
|
dockerfile: Dockerfile.stdiscosrv
|
2023-07-03 10:08:53 +00:00
|
|
|
image: syncthing/discosrv
|
2023-06-14 07:23:52 +00:00
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-14 07:23:52 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-06-14 07:23:52 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2023-06-14 07:37:59 +00:00
|
|
|
cache: false
|
|
|
|
check-latest: true
|
2023-06-14 07:23:52 +00:00
|
|
|
|
2023-11-13 11:20:40 +00:00
|
|
|
- name: Get actual Go version
|
|
|
|
run: |
|
|
|
|
go version
|
|
|
|
echo "GO_VERSION=$(go version | sed 's#^.*go##;s# .*##')" >> $GITHUB_ENV
|
|
|
|
|
2024-01-31 07:33:02 +00:00
|
|
|
- uses: actions/cache@v4
|
2023-06-14 07:23:52 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
2023-07-01 06:35:41 +00:00
|
|
|
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-docker-${{ matrix.pkg }}-${{ hashFiles('**/go.sum') }}
|
2023-06-14 07:23:52 +00:00
|
|
|
|
|
|
|
- name: Build binaries
|
|
|
|
run: |
|
2023-07-08 08:33:40 +00:00
|
|
|
for arch in amd64 arm64 arm; do
|
2023-07-01 06:35:41 +00:00
|
|
|
go run build.go -goos linux -goarch "$arch" -no-upgrade build ${{ matrix.pkg }}
|
|
|
|
mv ${{ matrix.pkg }} ${{ matrix.pkg }}-linux-"$arch"
|
2023-06-14 07:23:52 +00:00
|
|
|
done
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: "0"
|
|
|
|
BUILD_USER: docker
|
|
|
|
|
2023-07-08 08:33:40 +00:00
|
|
|
- name: Check if we will be able to push images
|
|
|
|
run: |
|
|
|
|
if [[ "${{ secrets.DOCKERHUB_TOKEN }}" != "" ]]; then
|
|
|
|
echo "DOCKER_PUSH=true" >> $GITHUB_ENV;
|
|
|
|
fi
|
|
|
|
|
2023-06-14 07:23:52 +00:00
|
|
|
- name: Login to Docker Hub
|
2023-09-25 19:50:17 +00:00
|
|
|
uses: docker/login-action@v3
|
2023-07-08 08:33:40 +00:00
|
|
|
if: env.DOCKER_PUSH == 'true'
|
2023-06-14 07:23:52 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-09-25 19:50:17 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-06-14 07:23:52 +00:00
|
|
|
|
|
|
|
- name: Set version tags
|
|
|
|
run: |
|
|
|
|
version=$(go run build.go version)
|
|
|
|
version=${version#v}
|
|
|
|
if [[ $version == @([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]).@([0-9]|[0-9][0-9]) ]] ; then
|
|
|
|
echo Release version, pushing to :latest and version tags
|
|
|
|
major=${version%.*.*}
|
|
|
|
minor=${version%.*}
|
2023-07-03 10:08:53 +00:00
|
|
|
tags=${{ matrix.image }}:$version,${{ matrix.image }}:$major,${{ matrix.image }}:$minor,${{ matrix.image }}:latest
|
2023-06-14 07:23:52 +00:00
|
|
|
elif [[ $version == *-rc.@([0-9]|[0-9][0-9]) ]] ; then
|
|
|
|
echo Release candidate, pushing to :rc
|
2023-07-03 10:08:53 +00:00
|
|
|
tags=${{ matrix.image }}:rc
|
2023-06-14 07:23:52 +00:00
|
|
|
else
|
|
|
|
echo Development version, pushing to :edge
|
2023-07-03 10:08:53 +00:00
|
|
|
tags=${{ matrix.image }}:edge
|
2023-06-14 07:23:52 +00:00
|
|
|
fi
|
|
|
|
echo "DOCKER_TAGS=$tags" >> $GITHUB_ENV
|
2023-11-14 06:46:14 +00:00
|
|
|
echo "VERSION=$version" >> $GITHUB_ENV
|
2023-06-14 07:23:52 +00:00
|
|
|
|
2023-07-01 06:35:41 +00:00
|
|
|
- name: Build and push Docker image
|
2023-09-25 19:50:17 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2023-06-14 07:23:52 +00:00
|
|
|
with:
|
|
|
|
context: .
|
2023-07-01 06:35:41 +00:00
|
|
|
file: ${{ matrix.dockerfile }}
|
2023-07-08 08:33:40 +00:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/7
|
|
|
|
push: ${{ env.DOCKER_PUSH == 'true' }}
|
2023-06-14 07:23:52 +00:00
|
|
|
tags: ${{ env.DOCKER_TAGS }}
|
2023-11-14 07:17:34 +00:00
|
|
|
labels: |
|
|
|
|
org.opencontainers.image.version=${{ env.VERSION }}
|
|
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
2023-07-20 05:05:35 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Check for known vulnerabilities in Go dependencies
|
|
|
|
#
|
|
|
|
|
|
|
|
govulncheck:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Run govulncheck
|
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-20 05:05:35 +00:00
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-07-20 05:05:35 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: false
|
|
|
|
check-latest: true
|
|
|
|
|
|
|
|
- name: run govulncheck
|
|
|
|
run: |
|
|
|
|
go run build.go assets
|
|
|
|
go install golang.org/x/vuln/cmd/govulncheck@latest
|
|
|
|
govulncheck ./...
|