From 4116dfc803111eefcbc0ed5f40abf2f7c32ba428 Mon Sep 17 00:00:00 2001 From: Alex Kataev Date: Fri, 28 Apr 2023 21:16:23 +0500 Subject: [PATCH] update ci --- .github/dependabot.yml | 3 --- .github/workflows/go-test.yml | 13 ++++--------- .github/workflows/golangci-lint.yml | 13 ++++--------- .github/workflows/goreleaser.yml | 9 +++++---- .github/workflows/release.yml | 17 +++++++++++++++++ .github/workflows/test.yml | 13 +++++++++++++ .goreleaser.yaml | 5 ++--- README.md | 3 ++- 8 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2dc42ec..b5342d4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,3 @@ -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - version: 2 updates: - directory: . diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 1c6f6a3..0f4c80f 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -1,20 +1,15 @@ name: go-test on: - push: - branches: - - main - tags: - - '*' - pull_request: + workflow_call: jobs: - go: + go-test: name: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.20' - - run: go test -v ./... + - run: go test -race -v ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 71b6136..fde5f36 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,20 +1,15 @@ name: golangci-lint on: - push: - branches: - - main - tags: - - '*' - pull_request: + workflow_call: jobs: - golangci: - name: lint + golangci-lint: + name: run runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.20' - uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index f9ec772..c77940e 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -1,9 +1,10 @@ name: goreleaser +permissions: + contents: write + on: - push: - tags: - - 'v*.*.*' + workflow_call: jobs: goreleaser: @@ -11,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.20' - uses: goreleaser/goreleaser-action@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f87a681 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + go-test: + uses: ./.github/workflows/go-test.yml + golangci-lint: + uses: ./.github/workflows/golangci-lint.yml + goreleaser: + needs: + - go-test + - golangci-lint + uses: ./.github/workflows/goreleaser.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9840676 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,13 @@ +name: test + +on: + push: + branches: + - main + pull_request: + +jobs: + go-test: + uses: ./.github/workflows/go-test.yml + golangci-lint: + uses: ./.github/workflows/golangci-lint.yml diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 28b7326..ffa9d5e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -2,6 +2,8 @@ project_name: tg builds: - id: tg main: ./cmd/tg + ldflags: + - -s -w binary: tg goos: - darwin @@ -18,7 +20,6 @@ archives: - tg name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}' format: tar.gz - wrap_in_directory: false files: - xyz* checksum: @@ -26,5 +27,3 @@ checksum: algorithm: sha256 changelog: use: github-native -source: - enabled: false diff --git a/README.md b/README.md index 73db37e..802b837 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,6 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/a-kataev/tg)](https://goreportcard.com/report/github.com/a-kataev/tg) [![Go Reference](https://pkg.go.dev/badge/github.com/a-kataev/tg.svg)](https://pkg.go.dev/github.com/a-kataev/tg) +![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/a-kataev/tg) -Another 😩 simple library for sending *text* messages via telegram bot +Another 😩 simple library (and cli 😉) for sending *text* messages via telegram bot