diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..ed7f56f --- /dev/null +++ b/.github/workflows/check.yaml @@ -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 ./... diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..9572546 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..e35e536 --- /dev/null +++ b/.goreleaser.yaml @@ -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 + 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:' diff --git a/README.md b/README.md index 422282b..1787194 100644 --- a/README.md +++ b/README.md @@ -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