From 202ff3df6d6d8e278a4f3b774bd26af0592bd23a Mon Sep 17 00:00:00 2001 From: Robert Janetzko Date: Tue, 10 May 2022 17:47:51 +0000 Subject: [PATCH] goreleaser --- .devcontainer/Dockerfile | 3 ++- .github/workflows/build.yml | 46 +++++++++++++++++++------------------ backend/.gitignore | 3 ++- backend/.goreleaser.yaml | 23 +++++++++++++++++++ 4 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 backend/.goreleaser.yaml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index eb4d00a..b9d28c1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -21,4 +21,5 @@ USER vscode # RUN npm install -g @angular/CLI # [Optional] Uncomment this line to install global node packages. # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 -RUN go install github.com/tc-hib/go-winres@latest \ No newline at end of file +RUN go install github.com/tc-hib/go-winres@latest \ + && go install github.com/goreleaser/goreleaser@latest \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0861c09..3c9dc2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,10 @@ name: Build LegendsBrowser on: push: branches: [ master ] + tags: [ '**' ] pull_request: branches: [ master ] + workflow_dispatch: jobs: @@ -18,26 +20,26 @@ jobs: with: go-version: 1.18 - - name: Build MacOS - run: cd backend && GOOS=darwin GOARCH=amd64 go build -o ../bin/legendsbrowser-mac-intel - - name: Build Linux - run: cd backend && GOOS=linux GOARCH=amd64 go build -o ../bin/legendsbrowser-linux-x64 - - name: Build Windows - run: cd backend && GOOS=windows GOARCH=amd64 go build -o ../bin/legendsbrowser-win-x64.exe + - name: Build + run: cd backend && go build -v ./... - - name: Upload MacOS Artifact - uses: actions/upload-artifact@v3 - with: - name: mac-os - path: bin/legendsbrowser-mac-intel - - name: Upload Linux Artifact - uses: actions/upload-artifact@v3 - with: - name: linux - path: bin/legendsbrowser-linux-x64 - - name: Upload MacOS Artifact - uses: actions/upload-artifact@v3 - with: - name: windows - path: bin/legendsbrowser-win-x64.exe - \ No newline at end of file + release: + runs-on: ubuntu-latest + needs: [ build ] + if: ${{ startsWith(github.ref, 'refs/tags/') }} + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + workdir: backend + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/backend/.gitignore b/backend/.gitignore index 193473a..f4167e3 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -2,4 +2,5 @@ resources/frontend/* same.json conf.json _conf.json -/*.png \ No newline at end of file +/*.png +dist/ diff --git a/backend/.goreleaser.yaml b/backend/.goreleaser.yaml new file mode 100644 index 0000000..ac3c765 --- /dev/null +++ b/backend/.goreleaser.yaml @@ -0,0 +1,23 @@ +builds: + - binary: legendsbrowser + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 +archives: + - format: zip + name_template: "legendsbrowser-{{ .Version }}-{{ .Os }}" + replacements: + darwin: macos + linux: linux + windows: win +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:'