Skip to content

Commit

Permalink
Fix conflicts with origin commits
Browse files Browse the repository at this point in the history
  • Loading branch information
celestix committed Sep 8, 2022
2 parents 78a96be + aec9c23 commit cd37947
Show file tree
Hide file tree
Showing 8 changed files with 245 additions and 102 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,28 @@ name: CI

on:
push:
branches:
branches:
- main
- dev
pull_request:
workflow_dispatch:

jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
go-version: ['1.18', '1.19']
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- name: Set up ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- name: Build app
run: |-
go build -o out/GigaUserbot -ldflags="-w -s" .
docker-build:
name: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
tags: divkix/giga-userbot:latest
version: latest
args: release --snapshot --skip-publish --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true

jobs:
goreleaser:
name: Release Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- uses: actions/setup-go@v3
with:
go-version: 1.19

# only run this step when the tag is not already created
- if: startsWith(github.ref, 'refs/tags/') != 'true' && github.event.inputs.tag != ''
name: Create and Push Tag
run: |-
git config --global user.email "[email protected]"
git config --global user.name "Divanshu Chauhan"
tag=${{ github.event.inputs.tag }} # if triggered by workflow_dispatch
if [ -z "$tag" ]; then
tag=${GITHUB_REF#refs/tags/}
fi
git tag -f -a -m "$tag" "$tag"
git push -f origin "$tag"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ ignore.config.json

# output directory
out/

dist/

dist/
87 changes: 87 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
project_name: giga
release:
replace_existing_draft: true
header: |
Welcome to this new release!
footer: |
Docker Images:
`docker.io/divideprojects/{{ .ProjectName }}:latest`
`ghcr.io/gigauserbot/{{ .ProjectName }}:latest`
before:
hooks:
- go mod tidy
- go mod download
builds:
- goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}
archives:
- format: binary
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"

dockers:
# amd64 only
- goarch: amd64
dockerfile: goreleaser.Dockerfile
use: buildx
image_templates:
- "docker.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/gigauserbot/{{ .ProjectName }}:{{ .Tag }}-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- changelog.json
# arm64 only
- goarch: arm64
dockerfile: goreleaser.Dockerfile
use: buildx
image_templates:
- "docker.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
- "ghcr.io/gigauserbot/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- changelog.json

docker_manifests:
# docker hub
- name_template: "docker.io/divideprojects/{{ .ProjectName }}:{{ .Version }}"
image_templates:
- "docker.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "docker.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
- name_template: "docker.io/divideprojects/{{ .ProjectName }}:latest"
image_templates:
- "docker.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "docker.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-arm64v8"

# github container registry
- name_template: "ghcr.io/gigauserbot/{{ .ProjectName }}:{{ .Version }}"
image_templates:
- "ghcr.io/gigauserbot/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/gigauserbot/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
- name_template: "ghcr.io/gigauserbot/{{ .ProjectName }}:latest"
image_templates:
- "ghcr.io/gigauserbot/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/gigauserbot/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Build Stage: Build bot using the alpine image, also install doppler in it
FROM golang:latest AS builder
FROM golang:1.19 AS builder
RUN apt-get update && apt-get upgrade -y && apt-get install build-essential -y
WORKDIR /app
COPY . .
RUN GOOS=`go env GOHOSTOS` GOARCH=`go env GOHOSTARCH` go build -o out/GigaUserbot -ldflags="-w -s" .

# Run Stage: Run bot using the bot and doppler binary copied from build stage
FROM golang:latest
FROM golang:1.19
COPY --from=builder /app/out/GigaUserbot /app/GigaUserbot
COPY changelog.json /app/changelog.json
COPY --from=builder /app/changelog.json /app/changelog.json
CMD ["/app/GigaUserbot"]
33 changes: 17 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ module github.com/gigauserbot/giga
go 1.18

require (
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.9
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.10
github.com/anonyindian/gotgproto v1.0.0-beta08.0.20220813082126-f98d0f42e1d5
github.com/anonyindian/logger v1.0.0-alpha.3
github.com/go-git/go-git/v5 v5.4.2
github.com/go-redis/redis v6.15.9+incompatible
github.com/gotd/td v0.67.0
github.com/gotd/td v0.68.1
github.com/joho/godotenv v1.4.0
)

require (
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/cloudflare/circl v1.2.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-faster/jx v0.39.0 // indirect
github.com/go-faster/xor v0.3.0 // indirect
Expand All @@ -28,29 +29,29 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/gotd/ige v0.2.2 // indirect
github.com/gotd/neo v0.1.5 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/mattn/go-sqlite3 v1.14.14 // indirect
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.20.0 // indirect
github.com/onsi/gomega v1.20.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/xanzy/ssh-agent v0.3.2 // indirect
go.opentelemetry.io/otel v1.9.0 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.22.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gorm.io/driver/sqlite v1.3.6 // indirect
gorm.io/gorm v1.23.8 // indirect
Expand Down
Loading

0 comments on commit cd37947

Please sign in to comment.