Skip to content

Commit

Permalink
chore: add github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
omarahm3 committed Sep 28, 2022
1 parent 6001daa commit 47b95f4
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check

on:
push:
branches:
- 'master'

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Format
run: gofmt -w -s .

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore(format): automated format change"
branch: master

- name: Build
run: go build -v ./...
47 changes: 47 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
branches:
- 'master'
tags:
- 'v*'
- latest
pull_request:

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- main: ./main.go
id: turtle
binary: turtle
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0

archives:
- id: turtle
builds:
- turtle
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64

nfpms:
- id: turtle
maintainer: omarahm3 <me@mrg.sh>
description: Rsync wrapper to do multiple transfers from a single yaml file
homepage: https://github.com/omarahm3/turtle
license: MIT
package_name: turtle
builds:
- turtle
formats:
- deb
- rpm
- apk

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ While programmes like nethogs and bandwhich are excellent for tracking network b
If you already have go installed:

```bash
go install github.com/omarahm3/backer@latest
go install github.com/omarahm3/turtle@latest
```

Or from releases page
Expand Down

0 comments on commit 47b95f4

Please sign in to comment.