diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e30032878..71d89d90d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,10 @@ name: Build -on: [push, pull_request] +on: + push: + pull_request: + types: [closed] + branches: + - master jobs: go: name: Test Server on ${{ matrix.os }} @@ -38,7 +43,6 @@ jobs: js: name: Test UI runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 @@ -68,3 +72,40 @@ jobs: run: | cd ui npm run build + + - uses: actions/upload-artifact@v1 + with: + name: js-bundle + path: ui/build + + build: + name: Build snapshot binaries + if: github.event.pull_request.merged || github.event_name == 'push' + needs: [js] + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v1 + with: + fetch-depth: 0 + + - name: Fetch tags + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* + + - uses: actions/download-artifact@v1 + with: + name: js-bundle + path: ui/build + + - name: Run GoReleaser + uses: docker://deluan/ci-goreleaser:1.14.1-1 + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: goreleaser release --rm-dist --skip-publish --snapshot + + - uses: actions/upload-artifact@v1 + with: + name: binaries + path: dist diff --git a/.goreleaser.yml b/.goreleaser.yml index a56824371..f763f35ac 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -17,7 +17,7 @@ builds: flags: - -tags=embed ldflags: - - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}} + - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Version}} - id: navidrome_linux_amd64 env: @@ -30,7 +30,7 @@ builds: - -tags=embed ldflags: - "-extldflags '-static'" - - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}} + - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Version}} - id: navidrome_linux_musl_amd64 env: @@ -44,7 +44,7 @@ builds: - -tags=embed ldflags: - "-extldflags '-static'" - - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}} + - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Version}} - id: navidrome_linux_arm env: @@ -61,7 +61,7 @@ builds: - -tags=embed ldflags: - "-extldflags '-static'" - - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}} + - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Version}} - id: navidrome_linux_arm64 env: @@ -75,7 +75,7 @@ builds: - -tags=embed ldflags: - "-extldflags '-static'" - - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}} + - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Version}} - id: navidrome_windows_i686 env: @@ -90,7 +90,7 @@ builds: - -tags=embed ldflags: - "-extldflags '-static'" - - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}} + - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Version}} - id: navidrome_windows_x64 env: @@ -105,7 +105,7 @@ builds: - -tags=embed ldflags: - "-extldflags '-static'" - - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Tag}} + - -X github.com/deluan/navidrome/consts.gitSha={{.ShortCommit}} -X github.com/deluan/navidrome/consts.gitTag={{.Version}} archives: - id: musl @@ -134,10 +134,10 @@ archives: amd64: x86_64 checksum: - name_template: '{{ .ProjectName }}_checksums.txt' + name_template: "{{ .ProjectName }}_checksums.txt" snapshot: - name_template: "{{ .Tag }}-next" + name_template: "{{ .Tag }}-SNAPSHOT" release: draft: true @@ -146,4 +146,4 @@ changelog: sort: asc filters: exclude: - - '^docs:' + - "^docs:"