Skip to content

Commit

Permalink
some release changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Divkix committed Jun 11, 2023
1 parent 959c79c commit 9d11a33
Show file tree
Hide file tree
Showing 7 changed files with 370 additions and 62 deletions.
38 changes: 34 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,42 @@ on:
push:
branches:
- main
- dev
tags-ignore:
- "**"
pull_request:
workflow_dispatch:

jobs:
ci:
uses: divkix/reusable-workflows/.github/workflows/goreleaser-ci.yml@main
with:
GH_PAT: ${{ secrets.GITHUB_TOKEN }}
secrets: inherit
name: Goreleaser CI
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "stable"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --snapshot --skip-publish --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Tar files
run: tar -czvf artifacts.tar.gz dist/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts.tar.gz
76 changes: 50 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,52 @@ on:
required: true

jobs:
goreleaser:
name: Release Binaries
ci:
name: Goreleaser CI
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
fetch-depth: 0

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
go-version: "stable"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v2
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
version: latest
args: release --snapshot --skip-publish --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- uses: actions/setup-go@v4
goreleaser:
name: Run GoReleaser
needs: update-install-script
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19

# only run this step when the tag is not already created
go-version: "stable"
- name: Install UPX
uses: crazy-max/ghaction-upx@v2
with:
install-only: true
# 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: |-
Expand All @@ -55,11 +68,22 @@ jobs:
fi
git tag -f -a -m "$tag" "$tag"
git push -f origin "$tag"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
95 changes: 75 additions & 20 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
project_name: alitagorobot
project_name: alita_robot

release:
replace_existing_draft: true
header: |
Welcome to this new release!
footer: |
Docker Images:
`ghcr.io/divkix/{{ .ProjectName }}:latest`
Docker 🐳 images are available at:
`docker pull ghcr.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}`
gomod:
env:
- CGO_ENABLED=1

before:
hooks:
- go mod tidy
- go mod download

# upx:
# - enabled: true
# brute: true

builds:
- goos:
- binary: alita
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
- darwin
goarch:
- amd64
- arm64
Expand All @@ -23,33 +37,75 @@ builds:
- -trimpath
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }}

archives:
- format: binary
- rlcp: true
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- if eq .Os "darwin" }}macOS
{{- else }}{{ .Os }}{{ end }}_
{{- if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- with .Arm }}v{{ . }}{{ end }}
{{- with .Mips }}_{{ . }}{{ end }}
{{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}
format_overrides:
- goos: windows
format: zip

signs:
- artifacts: all
args:
- "-u"
- "C4223C5D4162629F38AF4DD530695AF88CC00E38"
- "--output"
- "${signature}"
- "--batch"
- "--yes"
- "--pinentry-mode"
- "loopback"
- "--passphrase"
- "$GPG_PASSPHRASE"
- "--detach-sign"
- "${artifact}"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- "^chore:"
- "^ci:"
- Merge pull request
- Merge branch

checksum:
name_template: "checksums.txt"
algorithm: sha256

snapshot:
name_template: "{{ incpatch .Version }}-next"

dockers:
# amd64 only
- goarch: amd64
dockerfile: goreleaser.Dockerfile
dockerfile: docker/goreleaser
use: buildx
image_templates:
- "ghcr.io/divkix/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/divideprojects/{{ .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}}"
# arm64 only
- goarch: arm64
dockerfile: goreleaser.Dockerfile
dockerfile: docker/goreleaser
use: buildx
image_templates:
- "ghcr.io/divkix/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
- "ghcr.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--pull"
Expand All @@ -59,12 +115,11 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"

docker_manifests:
# github container registry
- name_template: "ghcr.io/divkix/{{ .ProjectName }}:{{ .Version }}"
- name_template: "ghcr.io/divideprojects/{{ .ProjectName }}:{{ .Version }}"
image_templates:
- "ghcr.io/divkix/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/divkix/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
- name_template: "ghcr.io/divkix/{{ .ProjectName }}:latest"
- "ghcr.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
- name_template: "ghcr.io/divideprojects/{{ .ProjectName }}:latest"
image_templates:
- "ghcr.io/divkix/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/divkix/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
- "ghcr.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/divideprojects/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: /app/AlitaGoRobot
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
<img src="https://img.shields.io/github/license/DivideProjects/Alita_Robot?style=flat-square" alt="LICENSE">
<img src="https://img.shields.io/github/contributors/DivideProjects/Alita_Robot?style=flat-square" alt="Contributors">
<img src="https://img.shields.io/github/repo-size/DivideProjects/Alita_Robot?style=flat-square" alt="Repo Size">
<img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/divideprojects/Alita_Robot&amp;title=Profile%20Views" alt="Views">
<img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/divideprojects/Alita_Robot&amp;title=Repo%20Views" alt="Views">
</p>

<p align='center'>
<a href="https://go.dev/" alt="made-with-go"> <img src="https://img.shields.io/badge/Made%20with-Go-1f425f.svg?style=flat-square&logo=Go&color=blue" /> </a>
<a href="https://hub.docker.com/r/divideprojects/alita_robot" alt="Docker!"> <img src="https://aleen42.github.io/badges/src/docker.svg" /> </a>
<a href="https://deepsource.io/gh/DivideProjects/Alita_Robot/?ref=repository-badge"><img src="https://static.deepsource.io/deepsource-badge-light-mini.svg" alt="DeepSource"></a>
<a href="https://makeapullrequest.com" alt="PRs Welcome"> <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" /> </a>
</p>
Expand All @@ -33,11 +32,10 @@ Can be found on Telegram as [@Alita_Robot](https://t.me/Alita_Robot)
Alita is currently available in 1 Language as of now:
- **US English**

More languages can be managed in the _locales_ folder.
More languages can be managed in the _locales_ folder. Although we have added support for languages in bot, we still need contributors to translate the bot to other languages.

More langauges have been added to locales folder but need some configuration.


Help us bring more languages to the bot by contributing to the project on [Crowdin](https://crowdin.com/project/alitarobot)

## Requirements
Expand All @@ -47,7 +45,6 @@ Help us bring more languages to the bot by contributing to the project on [Crowd
or
- Docker (Easiest way to setup the bot)


## How to setup

First Step!
Expand All @@ -61,11 +58,11 @@ It really motivates me to continue this project further.
- Get your Bot Token from [@BotFather](https://t.me/BotFather)

**Note:** As it is banned with an unknown reason in heroku, follow the below steps carefully!
- First Fork this repo :)
- First Fork this repo `:)`
- secondly, create an empty app in the Heroku, with a custom app name; and select Europe region for faster speed.
- Now go to the deploy tab of your app and under deployment method select GitHub and connect it.
- after that, type the forked repo name and select it now select main branch and enable auto deploy, at last click on deploy now button!
- Lastly, you must fill up all the vars in heroku as directed in app.json file and now turn on the worker dyno to run it :)
- Lastly, you must fill up all the vars in heroku (if using heroku) as directed in app.json file and now turn on the worker dyno to run it `:)`

### Traditional

Expand All @@ -76,19 +73,36 @@ It really motivates me to continue this project further.

### Docker

- Clone the repo and enter into it
- Install [Docker](https://www.docker.com/)
- Run `docker build -t alita .` if you're using your forked repo, else run `docker run -e ENV_VAR=VALUE -d --name alita divideprojects/Alita_Robot`
We currently publish a `ghcr.io/divideprojects/alita_robot` Docker image based on alpine.

Set the Environmental vars using the `-e` flag in while running the container.

If all works well, bot should send message to the **MESSAGE_DUMP** Group!

### Other

You can download all binaries and release artifacts from the Releases page. Binaries are built for macOS, Linux, Windows, for amd64 and arm64 architectures.

If a binary does not yet exist for the OS/architecture you use, please open a GitHub Issue.

## Verify Signature

You can verify the integrity and authenticity of any released artifact using a public GPG key. All release artifacts are signed and have a corresponding signature file. Release artifacts are available on the Releases page.

# fetch GPG signing key
```bash
gpg --keyserver keyserver.ubuntu.com --recv 9CAFFF2AC5F94C7C
```
# example: verify a release package
```bash
gpg --verify alita_robot_2.0.1_darwin_amd64.tar.gz.sig alita_robot_2.0.1_darwin_amd64.tar.gz || echo "Verification failed!"
```

## Contributing to the project

- Make sure your PR works and doesn't break anything.
- You must join the support group.
- Make sure it builds and runs properly.
- You must join the support group [here](https://dividesupport.t.me).
- Make sure the CI passes.


## Special Thanks to
Expand Down
3 changes: 3 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
docker:
web: Dockerfile
Loading

0 comments on commit 9d11a33

Please sign in to comment.