Update rogueserver

This commit is contained in:
Jonas Pinson 2024-05-14 21:12:01 +02:00
parent 2da5ccaa33
commit c14d667fc1
3 changed files with 1 additions and 95 deletions

View File

@ -1,52 +0,0 @@
name: Build
on:
push:
pull_request:
jobs:
build:
name: Build (${{ matrix.os_name }})
env:
GO_VERSION: 1.22
GOOS: ${{ matrix.os_name }}
GOARCH: ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
os_name: linux
arch: amd64
- os: windows-latest
os_name: windows
arch: amd64
# TODO macos needs universal binary!
# - os: macos-latest
# os_name: macos
steps:
- uses: actions/checkout@v4
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install dependencies
run: go mod download
- name: Lint Codebase
continue-on-error: true
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --config .golangci.yml
- name: Test
run: go test -v
- name: Build
run: go build -v
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: rogueserver-${{ matrix.os_name }}-${{ matrix.arch }}-${{ github.sha }}
path: |
rogueserver*
!rogueserver.go

View File

@ -1,38 +0,0 @@
name: Publish to GHCR
on:
push:
jobs:
build:
name: Build and publish to GHCR
if: github.repository == 'pagefaultgames/rogueserver'
env:
GO_VERSION: 1.22
runs-on: ubuntu-latest
steps:
- name: Setup Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Log into container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
VERSION=${{ github.ref_name }}-SNAPSHOT
COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}

View File

@ -45,7 +45,6 @@ func main() {
dbaddr := os.Getenv("dbaddr")
dbname := os.Getenv("dbname")
flag.Parse()
// register gob types
@ -76,11 +75,8 @@ func main() {
handler := prodHandler(mux)
if debug {
handler = debugHandler(mux)
}
} else {
err = http.ServeTLS(listener, handler, *tlscert, *tlskey)
err = http.Serve(listener, handler)
}
if err != nil {
log.Fatalf("failed to create http server or server errored: %s", err)