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
30 changes: 15 additions & 15 deletions .github/workflows/go-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ name: Go Tests

on:
push:
branches: [ 'main', 'develop' ]
branches: ["main", "develop"]
pull_request:
branches: [ '*' ]
branches: ["*"]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Download dependencies
run: make dep
- name: Build
run: make build
- name: Test
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: Download dependencies
run: make tidy
- name: Build
run: make build
- name: Test
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
74 changes: 37 additions & 37 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Release
on:
push:
tags:
- 'v*.*.*'
- "v*.*.*"

jobs:
build:
Expand All @@ -14,51 +14,51 @@ jobs:
go-version: [1.22]

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Set Release Version
id: set_release_version
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set Release Version
id: set_release_version
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Install dependencies
run: make dep
- name: Install dependencies
run: make tidy

- name: Build
run: |
export AppVersion="${{ env.RELEASE_VERSION }}"
echo "Building version: $AppVersion"
make dist
- name: Build
run: |
export AppVersion="${{ env.RELEASE_VERSION }}"
echo "Building version: $AppVersion"
make dist

- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: build
if-no-files-found: error
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: build
if-no-files-found: error

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build
path: build
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build
path: build

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: ./build/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: ./build/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 23 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := $(or $(AppVersion), "v1.1.2")
VERSION := $(or $(AppVersion), "v0.0.0")
COMMIT := $(or $(shell git rev-parse --short HEAD), "unknown")
BUILDDATE := $(shell date +%Y-%m-%d)

Expand All @@ -9,7 +9,7 @@ ARCHITECTURES = amd64 arm64 arm

all: build

dep:
tidy:
go mod tidy

test:
Expand All @@ -19,15 +19,27 @@ run: build
./chatz "This is test."

install: build
cp chatz /usr/local/bin/chatz
cp man/chatz.1 /usr/local/share/man/man1/chatz.1
@cp man/chatz.1 man/chatz.old
@sed -e "s|BUILDDATE|$(BUILDDATE)|g" -e "s|VERSION|$(VERSION)|g" man/chatz.old > man/chatz.1
@cp chatz /usr/local/bin/chatz
@cp man/chatz.1 /usr/local/share/man/man1/chatz.1
@mv man/chatz.old man/chatz.1
@echo "chatz successfully installed."

uninstall:
@rm /usr/local/bin/chatz
@rm /usr/local/share/man/man1/chatz.1
@echo "chatz successfully uninstalled."

build:
go build -ldflags="$(LDFLAGS)" -o chatz .

dist:
@cp man/chatz.1 man/chatz.old
@sed -e "s|BUILDDATE|$(BUILDDATE)|g" -e "s|VERSION|$(VERSION)|g" man/chatz.old > man/chatz.1
@for platform in $(PLATFORMS); do \
for arch in $(ARCHITECTURES); do \
if [ "$$platform" = "darwin" ] && [ "$$arch" = "arm" ]; then continue; fi; \
extension=""; if [ "$$platform" = "windows" ]; then extension=".exe"; fi; \
CGO_ENABLED=0 GOOS=$$platform GOARCH=$$arch go build -ldflags="$(LDFLAGS)" -o build/chatz-$$platform-$$arch$$extension; \
if [ ! -f build/chatz-$$platform-$$arch ]; then continue; fi; \
Expand All @@ -36,7 +48,13 @@ dist:
tar -zcvf build/chatz-$$platform-$$arch.tar.gz build/chatz man/chatz.1; \
done \
done
rm build/chatz
@rm build/chatz
@mv man/chatz.old man/chatz.1
# Generating checksum
@cd build && sha256sum * > ../checksum-sha256sum.txt
@cd build && md5sum * > checksum-md5sum.txt
@cd build && mv ../checksum-sha256sum.txt checksum-sha256sum.txt
@echo "Checksum generated successfully."

clean:
rm -rf chatz build
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@ brew install chatz

### Linux Installation
```sh
curl -sL https://github.com/tech-thinker/chatz/releases/download/v1.1.3/chatz-linux-amd64 -o chatz
TAG=<tag-name>
curl -sL "https://github.com/tech-thinker/chatz/releases/download/${TAG}/chatz-linux-amd64" -o chatz
chmod +x chatz
sudo mv chatz /usr/bin
```

### MacOS Installation
```sh
curl -sL https://github.com/tech-thinker/chatz/releases/download/v1.1.3/chatz-darwin-amd64 -o chatz
TAG=<tag-name>
curl -sL "https://github.com/tech-thinker/chatz/releases/download/${TAG}/chatz-darwin-amd64" -o chatz
chmod +x chatz
sudo mv chatz /usr/bin
```

### Windows Installation
```sh
curl -sL https://github.com/tech-thinker/chatz/releases/download/v1.1.3/chatz-windows-amd64.exe -o chatz.exe
TAG=<tag-name>
curl -sL "https://github.com/tech-thinker/chatz/releases/download/${TAG}/chatz-windows-amd64.exe" -o chatz.exe
chatz.exe
```

Expand Down
3 changes: 1 addition & 2 deletions man/chatz.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH CHATZ 1 "September 25, 2024" "Version 1.1.2" "User Commands"
.TH CHATZ 1 "BUILDDATE" "Version VERSION" "User Commands"
.SH NAME
chatz \- a CLI tool for sending notifications to Google Chat, Slack, Discord, Telegram etc.
.SH SYNOPSIS
Expand Down Expand Up @@ -123,4 +123,3 @@ Ensure that each service is properly configured with valid tokens and webhook UR
.BR nano (1),
.SH AUTHOR
Written by tech-thinker, as part of the `chatz` project.

Loading