Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalter committed Apr 13, 2024
1 parent cf86848 commit a378559
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 11 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: goreleaser

on:
pull_request:
push:
tags:
- '*'

permissions:
contents: write
Expand All @@ -11,24 +12,18 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
- name: Set up Go
uses: actions/setup-go@v4
-
name: Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distributionasdfdsf
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY asdf}}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dist/*

*log

hotline-chat-gpt-bot.iml
hotline-chat-gpt-bot.iml
dist/
46 changes: 46 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.22 AS builder

WORKDIR /app
COPY . .

RUN CGO_ENABLED=0 go build -o /app/hl-bot . && chmod a+x /app/hl-bot

FROM debian:stable-slim

# Change these as you see fit. This makes bind mounting easier so you don't have to edit bind mounted config files as root.
ARG USERNAME=hl-bot
ARG UID=1001
ARG GUID=1001

COPY --from=builder /app/hl-bot /app/hl-bot
RUN useradd -d /app -u ${UID} ${USERNAME}
RUN chown -R ${USERNAME}:${USERNAME} /app

USER ${USERNAME}
ENTRYPOINT ["/app/hl-bot"]

0 comments on commit a378559

Please sign in to comment.