Skip to content

Commit

Permalink
Merge pull request #150 from screego/release
Browse files Browse the repository at this point in the history
fix multiarch & add ghcr.io images
  • Loading branch information
jmattheis authored Mar 17, 2023
2 parents 1b15de0 + d4ded43 commit 601e5dc
Show file tree
Hide file tree
Showing 28 changed files with 226 additions and 170 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- uses: actions/setup-node@v3
with:
node-version: '16'
Expand All @@ -28,25 +28,22 @@ jobs:
- run: (cd ui && yarn)
- run: (cd ui && yarn build)
- run: (cd ui && yarn testformat)
- uses: golangci/golangci-lint-action@v2
- uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
version: v1.51.1
- run: go build ./...
- run: go test -race ./...
- if: startsWith(github.ref, 'refs/tags/v')
run: echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin
run: |
echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username "${{ github.actor }}" --password-stdin
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
- if: startsWith(github.ref, 'refs/tags/v')
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: startsWith(github.ref, 'refs/tags/v')
run: make VERSION=${GITHUB_REF/refs\/tags\/v/} docker-manifest-annotate docker-manifest-push
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
21 changes: 4 additions & 17 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,35 @@
inters:
linters:
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- dogsled
- dupl
- errcheck
- exhaustive
- exportloopref
- gci
- gocritic
- godot
- goerr113
- gofmt
- gofumpt
- goimports
- golint
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- nolintlint
- prealloc
- rowserrcheck
- scopelint
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
disable:
- dupl
- gocritic
- goerr113
- funlen
- gochecknoglobals
- gocognit
Expand All @@ -59,7 +48,5 @@ inters:
linters-settings:
gofumpt:
extra-rules: true
goimports:
local-prefixes: github.com/screego/server
misspell:
locale: US
118 changes: 99 additions & 19 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ builds:
- freebsd
- openbsd
goarch:
- 386
- "386"
- amd64
- arm
- arm64
- ppc64
- ppc64le
goarm:
- 6
- 7
- "6"
- "7"
flags:
- '-tags="netgo osusergo"'
ldflags:
- '-s'
- '-w'
- '-X main.version={{.Version}}'
- '-X main.commitHash={{.Commit}}'
- '-X main.mode=prod'
- "-s"
- "-w"
- "-X main.version={{.Version}}"
- "-X main.commitHash={{.Commit}}"
- "-X main.mode=prod"
archives:
- files:
- LICENSE
Expand All @@ -42,84 +42,164 @@ archives:
- goos: windows
format: zip
checksum:
disable: true
changelog:
skip: true
dockers:
- goos: linux
- use: docker
goos: linux
goarch: amd64
goarm: ''
goarm: ""
image_templates:
- "screego/server:amd64-unstable"
- "screego/server:amd64-{{ .RawVersion }}"
- "screego/server:amd64-{{ .Major }}"
- "ghcr.io/screego/server:amd64-unstable"
- "ghcr.io/screego/server:amd64-{{ .RawVersion }}"
- "ghcr.io/screego/server:amd64-{{ .Major }}"
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- goos: linux
goarch: 386
goarm: ''
- use: docker
goos: linux
goarch: "386"
goarm: ""
image_templates:
- "screego/server:386-unstable"
- "screego/server:386-{{ .RawVersion }}"
- "screego/server:386-{{ .Major }}"
- "ghcr.io/screego/server:386-unstable"
- "ghcr.io/screego/server:386-{{ .RawVersion }}"
- "ghcr.io/screego/server:386-{{ .Major }}"
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/386"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- goos: linux
- use: docker
goos: linux
goarch: arm64
goarm: ''
goarm: ""
image_templates:
- "screego/server:arm64-unstable"
- "screego/server:arm64-{{ .RawVersion }}"
- "screego/server:arm64-{{ .Major }}"
- "ghcr.io/screego/server:arm64-unstable"
- "ghcr.io/screego/server:arm64-{{ .RawVersion }}"
- "ghcr.io/screego/server:arm64-{{ .Major }}"
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- goos: linux
- use: docker
goos: linux
goarch: arm
goarm: 7
image_templates:
- "screego/server:armv7-unstable"
- "screego/server:armv7-{{ .RawVersion }}"
- "screego/server:armv7-{{ .Major }}"
- "ghcr.io/screego/server:armv7-unstable"
- "ghcr.io/screego/server:armv7-{{ .RawVersion }}"
- "ghcr.io/screego/server:armv7-{{ .Major }}"
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- goos: linux
- use: docker
goos: linux
goarch: arm
goarm: 6
image_templates:
- "screego/server:armv6-unstable"
- "screego/server:armv6-{{ .RawVersion }}"
- "screego/server:armv6-{{ .Major }}"
- "ghcr.io/screego/server:armv6-unstable"
- "ghcr.io/screego/server:armv6-{{ .RawVersion }}"
- "ghcr.io/screego/server:armv6-{{ .Major }}"
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm/v6"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- goos: linux
- use: docker
goos: linux
goarch: ppc64le
goarm: ''
goarm: ""
image_templates:
- "screego/server:ppc64le-unstable"
- "screego/server:ppc64le-{{ .RawVersion }}"
- "screego/server:ppc64le-{{ .Major }}"
- "ghcr.io/screego/server:ppc64le-unstable"
- "ghcr.io/screego/server:ppc64le-{{ .RawVersion }}"
- "ghcr.io/screego/server:ppc64le-{{ .Major }}"
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/ppc64le"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
docker_manifests:
- name_template: "ghcr.io/screego/server:unstable"
image_templates:
- "ghcr.io/screego/server:amd64-unstable"
- "ghcr.io/screego/server:386-unstable"
- "ghcr.io/screego/server:arm64-unstable"
- "ghcr.io/screego/server:armv7-unstable"
- "ghcr.io/screego/server:armv6-unstable"
- "ghcr.io/screego/server:ppc64le-unstable"
- name_template: "screego/server:unstable"
image_templates:
- "screego/server:amd64-unstable"
- "screego/server:386-unstable"
- "screego/server:arm64-unstable"
- "screego/server:armv7-unstable"
- "screego/server:armv6-unstable"
- "screego/server:ppc64le-unstable"
- name_template: "screego/server:{{ .RawVersion }}"
image_templates:
- "screego/server:amd64-{{ .RawVersion }}"
- "screego/server:386-{{ .RawVersion }}"
- "screego/server:arm64-{{ .RawVersion }}"
- "screego/server:armv7-{{ .RawVersion }}"
- "screego/server:armv6-{{ .RawVersion }}"
- "screego/server:ppc64le-{{ .RawVersion }}"
- name_template: "ghcr.io/screego/server:{{ .RawVersion }}"
image_templates:
- "ghcr.io/screego/server:amd64-{{ .RawVersion }}"
- "ghcr.io/screego/server:386-{{ .RawVersion }}"
- "ghcr.io/screego/server:arm64-{{ .RawVersion }}"
- "ghcr.io/screego/server:armv7-{{ .RawVersion }}"
- "ghcr.io/screego/server:armv6-{{ .RawVersion }}"
- "ghcr.io/screego/server:ppc64le-{{ .RawVersion }}"
- name_template: "screego/server:{{ .Major }}"
image_templates:
- "screego/server:amd64-{{ .Major }}"
- "screego/server:386-{{ .Major }}"
- "screego/server:arm64-{{ .Major }}"
- "screego/server:armv7-{{ .Major }}"
- "screego/server:armv6-{{ .Major }}"
- "screego/server:ppc64le-{{ .Major }}"
- name_template: "ghcr.io/screego/server:{{ .Major }}"
image_templates:
- "ghcr.io/screego/server:amd64-{{ .Major }}"
- "ghcr.io/screego/server:386-{{ .Major }}"
- "ghcr.io/screego/server:arm64-{{ .Major }}"
- "ghcr.io/screego/server:armv7-{{ .Major }}"
- "ghcr.io/screego/server:armv6-{{ .Major }}"
- "ghcr.io/screego/server:ppc64le-{{ .Major }}"
25 changes: 0 additions & 25 deletions Makefile

This file was deleted.

6 changes: 2 additions & 4 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import (
"net/http"
"os"

"github.com/rs/zerolog/log"

"github.com/gorilla/sessions"
"github.com/rs/zerolog/log"
"golang.org/x/crypto/bcrypt"
)

Expand All @@ -32,7 +31,6 @@ func read(r io.Reader) ([]UserPW, error) {
reader.TrimLeadingSpace = true

records, err := reader.ReadAll()

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -130,7 +128,7 @@ func (u *Users) Authenticate(w http.ResponseWriter, r *http.Request) {
})
}

func (u Users) Validate(user string, password string) bool {
func (u Users) Validate(user, password string) bool {
realPassword, exists := u.Lookup[user]
return exists && bcrypt.CompareHashAndPassword([]byte(realPassword), []byte(password)) == nil
}
4 changes: 0 additions & 4 deletions cmd/serve.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package cmd

import (
mrand "math/rand"
"os"
"time"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
Expand All @@ -21,8 +19,6 @@ func serveCmd(version string) cli.Command {
return cli.Command{
Name: "serve",
Action: func(ctx *cli.Context) {

mrand.Seed(time.Now().Unix())
conf, errs := config.Get()
logger.Init(conf.LogLevel.AsZeroLogLevel())

Expand Down
Loading

0 comments on commit 601e5dc

Please sign in to comment.