feat: add SSO workspace, named shares and Debian release tooling
This commit is contained in:
1 parent
833d908884
commit
87bc33e675
106 files changed
+4160
-5637
No files matched your search
@@ -0,0 +1,32 @@
|
||||
param([string]$Version = '3.0.0-sso.1')
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$repo = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
Push-Location $repo
|
||||
try {
|
||||
if (Test-Path 'build/local-env/enter.ps1') { . ./build/local-env/enter.ps1 }
|
||||
Push-Location frontend
|
||||
try {
|
||||
$installArgs = @('install', '--frozen-lockfile')
|
||||
if (Test-Path '../build/local-env/pnpm-store') { $installArgs += @('--store-dir', '../build/local-env/pnpm-store') }
|
||||
pnpm @installArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Frontend dependency installation failed' }
|
||||
pnpm run build
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Frontend build failed' }
|
||||
} finally { Pop-Location }
|
||||
$commit = git rev-parse --short HEAD
|
||||
$release = Join-Path $repo 'build/release/linux-amd64'
|
||||
New-Item -ItemType Directory -Force $release | Out-Null
|
||||
$oldGoos, $oldGoarch, $oldGoamd64, $oldCgo = $env:GOOS, $env:GOARCH, $env:GOAMD64, $env:CGO_ENABLED
|
||||
try {
|
||||
$env:GOOS = 'linux'; $env:GOARCH = 'amd64'; $env:GOAMD64 = 'v1'; $env:CGO_ENABLED = '0'
|
||||
go build -trimpath -ldflags "-s -w -X github.com/filebrowser/filebrowser/v2/version.Version=$Version -X github.com/filebrowser/filebrowser/v2/version.CommitSHA=$commit" -o (Join-Path $release 'filebrowser') .
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Linux build failed' }
|
||||
} finally { $env:GOOS = $oldGoos; $env:GOARCH = $oldGoarch; $env:GOAMD64 = $oldGoamd64; $env:CGO_ENABLED = $oldCgo }
|
||||
Copy-Item -LiteralPath LICENSE -Destination (Join-Path $release 'LICENSE')
|
||||
Copy-Item -LiteralPath docs/deployment.md -Destination (Join-Path $release 'README.md')
|
||||
Copy-Item -LiteralPath deploy/filebrowser.service -Destination (Join-Path $release 'filebrowser.service')
|
||||
$archive = Join-Path $repo 'build/filebrowser-linux-amd64.tar.gz'
|
||||
go run ./scripts/package-release.go $release $archive
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Archive creation failed' }
|
||||
Write-Output "Built $archive ($Version, $commit, linux/amd64 v1, CGO disabled)"
|
||||
} finally { Pop-Location }
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
VERSION="${VERSION:-3.0.0-sso.1}"
|
||||
COMMIT=$(git rev-parse --short HEAD)
|
||||
(cd frontend && pnpm install --frozen-lockfile && pnpm run build)
|
||||
mkdir -p build/release/linux-amd64
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOAMD64=v1 go build -trimpath \
|
||||
-ldflags "-s -w -X github.com/filebrowser/filebrowser/v2/version.Version=$VERSION -X github.com/filebrowser/filebrowser/v2/version.CommitSHA=$COMMIT" \
|
||||
-o build/release/linux-amd64/filebrowser .
|
||||
cp LICENSE build/release/linux-amd64/LICENSE
|
||||
cp docs/deployment.md build/release/linux-amd64/README.md
|
||||
cp deploy/filebrowser.service build/release/linux-amd64/filebrowser.service
|
||||
go run ./scripts/package-release.go build/release/linux-amd64 build/filebrowser-linux-amd64.tar.gz
|
||||
echo "Built build/filebrowser-linux-amd64.tar.gz ($VERSION, $COMMIT)"
|
||||
@@ -0,0 +1,28 @@
|
||||
//go:build ignore
|
||||
|
||||
// Package the release with executable Unix permissions, including on Windows.
|
||||
package main
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"compress/gzip"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func main(){if err:=run();err!=nil{fmt.Fprintln(os.Stderr,err);os.Exit(1)}}
|
||||
func run()error{
|
||||
if len(os.Args)!=3{return fmt.Errorf("usage: package-release <release-directory> <output.tar.gz>")}
|
||||
dir,out:=os.Args[1],os.Args[2];file,err:=os.Create(out);if err!=nil{return err};defer file.Close()
|
||||
hash:=sha256.New();zip:=gzip.NewWriter(io.MultiWriter(file,hash));archive:=tar.NewWriter(zip)
|
||||
for _,name:=range []string{"filebrowser","LICENSE","README.md","filebrowser.service"}{
|
||||
f,err:=os.Open(filepath.Join(dir,name));if err!=nil{return err};info,err:=f.Stat();if err!=nil{f.Close();return err}
|
||||
h:=&tar.Header{Name:name,Mode:0644,Size:info.Size(),Typeflag:tar.TypeReg};if name=="filebrowser"{h.Mode=0755}
|
||||
if err=archive.WriteHeader(h);err==nil{_,err=io.Copy(archive,f)};f.Close();if err!=nil{return err}
|
||||
}
|
||||
if err=archive.Close();err!=nil{return err};if err=zip.Close();err!=nil{return err};if err=file.Close();err!=nil{return err}
|
||||
line:=fmt.Sprintf("%x %s\n",hash.Sum(nil),filepath.Base(out));return os.WriteFile(filepath.Join(filepath.Dir(out),"SHA256SUMS"),[]byte(line),0644)
|
||||
}
|
||||
Reference in new issue
Block a user