Skip to content

🎧 Your Personal Streaming Service

ci: create versions with goreleaser

Deluan476c695cf147
diff --git a/.dockerignore b/.dockerignore
index 8402e7126..fdc0bd0df 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -8,4 +8,7 @@ data
testDB
*_test.go
navidrome
+navidrome.db
+navidrome.toml
assets/*gen.go
+dist
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..0223d5e50
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,31 @@
+name: Release
+
+on:
+ create:
+ tags:
+ - v*.*.*
+jobs:
+ release:
+ name: Release
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Code
+ uses: actions/checkout@v1
+ with:
+ fetch-depth: 0
+ - uses: actions/setup-node@v1
+ with:
+ node-version: 13
+ - name: Build UI
+ run: |
+ cd ui
+ npm ci
+ npm run build
+ - name: Fetch tags
+ run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
+ - name: Run GoReleaser
+ uses: docker://bepsays/ci-goreleaser:1.13-4
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ args: goreleaser release --rm-dist
diff --git a/.gitignore b/.gitignore
index 157b700c0..9c68f8a25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,4 +18,3 @@ navidrome.db
*.swp
*_gen.go
dist
-.goreleaser.yml
diff --git a/.goreleaser.yml b/.goreleaser.yml
new file mode 100644
index 000000000..ed8dd0dee
--- /dev/null
+++ b/.goreleaser.yml
@@ -0,0 +1,86 @@
+# GoReleaser config
+
+before:
+ hooks:
+ - go get -u github.com/go-bindata/go-bindata/...
+ - go-bindata -fs -prefix ui/build -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/...
+ - git checkout .
+
+builds:
+ - id: navidrome_darwin
+ env:
+ - CGO_ENABLED=1
+ - CC=o64-clang
+ - CXX=o64-clang++
+ goos:
+ - darwin
+ goarch:
+ - amd64
+ flags:
+ - -tags=embed
+ ldflags:
+ - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+
+ - id: navidrome_linux
+ env:
+ - CGO_ENABLED=1
+ goos:
+ - linux
+ goarch:
+ - amd64
+ flags:
+ - -tags=embed
+ ldflags:
+ - "-extldflags '-static'"
+ - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+
+ - id: navidrome_windows_i686
+ env:
+ - CGO_ENABLED=1
+ - CC=i686-w64-mingw32-gcc
+ - CXX=i686-w64-mingw32-g++
+ goos:
+ - windows
+ goarch:
+ - 386
+ flags:
+ - -tags=embed
+ ldflags:
+ - "-extldflags '-static'"
+ - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+
+ - id: navidrome_windows_x64
+ env:
+ - CGO_ENABLED=1
+ - CC=x86_64-w64-mingw32-gcc
+ - CXX=x86_64-w64-mingw32-g++
+ goos:
+ - windows
+ goarch:
+ - amd64
+ flags:
+ - -tags=embed
+ ldflags:
+ - "-extldflags '-static'"
+ - -X main.gitSha={{.ShortCommit}} -X main.gitTag={{.Tag}}
+
+archives:
+ -
+ format_overrides:
+ - goos: windows
+ format: zip
+checksum:
+ name_template: 'checksums.txt'
+
+snapshot:
+ name_template: "{{ .Tag }}-next"
+
+release:
+ draft: true
+
+changelog:
+ sort: asc
+ filters:
+ exclude:
+ - '^docs:'
+ - '^test:'
diff --git a/Dockerfile b/Dockerfile
index 223844b7f..4a31f45df 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -34,7 +34,8 @@ COPY --from=jsbuilder /src/build/* /src/ui/build/
COPY --from=jsbuilder /src/build/static/css/* /src/ui/build/static/css/
COPY --from=jsbuilder /src/build/static/js/* /src/ui/build/static/js/
RUN rm -rf /src/build/css /src/build/js
-RUN make buildall
+RUN go-bindata -fs -prefix ui/build -tags embed -nocompress -pkg assets -o assets/embedded_gen.go ui/build/...\
+ && go build -ldflags="-X main.gitSha=${SOURCE_COMMIT} -X main.gitTag=${SOURCE_BRANCH}" -tags=embed
#####################################################
### Build Final Image
diff --git a/Makefile b/Makefile
index c83de9018..e0bbef9aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,7 @@
GO_VERSION=1.13
NODE_VERSION=v13.7.0
-GIT_HASH=$(shell git rev-parse --short HEAD)
-GIT_BRANCH=$(shell git symbolic-ref --short -q HEAD)
-GIT_TAG=$(shell git describe --tags --abbrev=0 2> /dev/null)
-GIT_COUNT=$(shell git rev-list HEAD --count)
+GIT_SHA=$(shell git rev-parse --short HEAD)
.PHONY: dev
dev: check_env data
@@ -72,10 +69,8 @@ assets/embedded_gen.go: ui/build
.PHONY: build
build: check_go_env
- go build -ldflags="-X main.gitCount=$(GIT_COUNT) -X main.gitHash=$(GIT_HASH) -X main.gitBranch=$(GIT_BRANCH) -X main.gitTag=$(GIT_TAG)"
+ go build -ldflags="-X main.gitSha=$(GIT_SHA) -X main.gitTag=master"
.PHONY: buildall
buildall: check_go_env assets/embedded_gen.go
- go build -ldflags="-X main.gitCount=$(GIT_COUNT) -X main.gitHash=$(GIT_HASH) -X main.gitBranch=$(GIT_BRANCH) -X main.gitTag=$(GIT_TAG)" \
- -tags embed
-
+ go build -ldflags="-X main.gitSha=$(GIT_SHA) -X main.gitTag=master" -tags=embed
diff --git a/README.md b/README.md
index 53b3f263d..a02f0cef0 100644
--- a/README.md
+++ b/README.md
@@ -40,9 +40,21 @@ on a frequent basis. Some upcoming features planned:
## Installation
-Currently there are no downloadable binaries (WIP). The available options are:
+Various options are available:
-### Run it with Docker
+### Pre-build executables
+
+Just head to the [releases page](https://github.com/deluan/navidrome/releases) and download the latest version for you
+platform. There are builds available for Linux, macOS and Windows (32 and 64 bits).
+
+Remember to install [ffmpeg](https://ffmpeg.org/download.html) in your system, a requirement for Navidrome to work properly.
+
+If you have any issues with these binaries, or need a binary for a different platform, please
+[open an issue](https://github.com/deluan/navidrome/issues)
+
+### Docker
+
+Docker images are available. Example of usage:
```yaml
# This is just an example. Customize it to your needs.
@@ -65,10 +77,10 @@ services:
- "/Users/deluan/Music/iTunes/iTunes Media/Music:/music"
```
-### Build it yourself / Development Environment
+### Build it yourself
You will need to install [Go 1.13](https://golang.org/dl/) and [Node 13.7](http://nodejs.org).
-You'll also need [ffmpeg](ffmpeg.org) installed in your system
+You'll also need [ffmpeg](https://ffmpeg.org) installed in your system
After the prerequisites above are installed, build the application with:
@@ -77,14 +89,16 @@ $ make setup
$ make buildall
```
-This will generate the `navidrome` binary in the project's root folder. Start the server with:
+This will generate the `navidrome` binary executable in the project's root folder.
+
+### Running for the first time
+
+Start the server with:
```shell script
./navidrome
```
The server should start listening for requests on the default port __4533__
-### Running for the first time
-
After starting Navidrome for the first time, go to http://localhost:4533. It will ask you to create your first admin
user.
diff --git a/banner.go b/banner.go
index 83f86f55d..abef60dd5 100644
--- a/banner.go
+++ b/banner.go
@@ -9,25 +9,19 @@ import (
var (
// This will be set in build time. If not, version will be set to "dev"
- gitBranch string
- gitTag string
- gitHash string
- gitCount string
+ gitTag string
+ gitSha string
)
// Formats:
// dev
-// v0.2.0 (596-5b84188)
-// master (600-9ed35cb)
+// v0.2.0 (5b84188)
+// master (9ed35cb)
func getVersion() string {
- if gitHash == "" {
+ if gitSha == "" {
return "dev"
}
- version := fmt.Sprintf(" (%s-%s)", gitCount, gitHash)
- if gitTag != "" {
- return gitTag + version
- }
- return gitBranch + version
+ return fmt.Sprintf("%s (%s)", gitTag, gitSha)
}
func getBanner() string {
diff --git a/ui/.gitignore b/ui/.gitignore
index 4d29575de..bd1906e59 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -8,9 +8,6 @@
# testing
/coverage
-# production
-/build
-
# misc
.DS_Store
.env.local
@@ -21,3 +18,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+
+build/*
+!build/.gitkeep
diff --git a/ui/build/.gitkeep b/ui/build/.gitkeep
new file mode 100644
index 000000000..e69de29bb