Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ ROCKETCHAT_BOT_USERNAME=geekbot
ROCKETCHAT_BOT_PASSWORD=your-password
ROCKETCHAT_MAIN_ADMIN=admin_username
STANDUP_DB_PATH=/data/standup-bot.db

# http_proxy=http://proxy:port
# https_proxy=http://proxy:port
# no_proxy=localhost,127.0.0.1
52 changes: 45 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: true
- run: go vet ./...

build:
runs-on: ubuntu-latest
steps:
Expand All @@ -15,9 +28,34 @@ jobs:
with:
go-version: "1.22"
cache: true
- name: Vet
run: go vet ./...
- name: Build
run: go build ./...
- name: Test
run: go test ./...
- run: go build ./...

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: true
- run: go test ./... -count=1 -race

docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Smoke test
run: docker build .
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/sunba91-su/roket.chat-geekbot:latest
ghcr.io/sunba91-su/roket.chat-geekbot:${{ github.sha }}
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
push:
tags:
- "v*.*.*"

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: true

- name: Vet and test
run: |
go vet ./...
go test ./... -count=1 -race

- name: Extract version from tag
id: meta
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/sunba91-su/roket.chat-geekbot:${{ steps.meta.outputs.VERSION }}
ghcr.io/sunba91-su/roket.chat-geekbot:latest

- name: Generate release notes
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
name: v${{ steps.meta.outputs.VERSION }}
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM golang:1.22-alpine AS builder
FROM golang:1.25-alpine AS builder
ARG http_proxy
ARG https_proxy
ARG no_proxy
RUN apk add --no-cache ca-certificates tzdata && \
adduser -D -u 1001 appuser
WORKDIR /src
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ clean:
rm -rf $(BIN_DIR)/

docker-build:
docker build -t $(APP_NAME) .
docker build \
--build-arg http_proxy \
--build-arg https_proxy \
--build-arg no_proxy \
-t $(APP_NAME) .

docker-run:
docker compose up -d --build
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
http_proxy: "${http_proxy:-}"
https_proxy: "${https_proxy:-}"
no_proxy: "${no_proxy:-}"
container_name: geekbot
restart: unless-stopped
env_file: .env
Expand Down
Loading