mirror of
https://github.com/bakito/adguardhome-sync.git
synced 2025-03-03 18:47:40 +08:00
prepare release
This commit is contained in:
parent
0d288e93c0
commit
f27414720c
9 changed files with 146 additions and 14 deletions
55
.github/workflows/go.yml
vendored
55
.github/workflows/go.yml
vendored
|
@ -7,20 +7,53 @@ on:
|
|||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
golangci:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||
version: v1.36
|
||||
|
||||
build:
|
||||
name: Build
|
||||
test:
|
||||
name: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.16
|
||||
id: go
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.16
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build
|
||||
run: make test
|
||||
- name: Test
|
||||
run: go test ./... -coverprofile=coverage.out
|
||||
|
||||
- name: Send coverage
|
||||
uses: shogo82148/actions-goveralls@v1
|
||||
with:
|
||||
path-to-profile: coverage.out
|
||||
|
||||
test-release:
|
||||
name: test release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.16
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
args: --skip-publish --snapshot --rm-dist
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
.idea
|
||||
coverage.out
|
||||
dist
|
||||
|
|
36
.goreleaser.yml
Normal file
36
.goreleaser.yml
Normal file
|
@ -0,0 +1,36 @@
|
|||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s -w -X github.com/bakito/adguardhome-sync/version.Version={{.Version}}
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
goarm:
|
||||
- 5
|
||||
- 6
|
||||
- 7
|
||||
hooks:
|
||||
post: upx {{ .Path }}
|
||||
archives:
|
||||
- replacements:
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
9
Makefile
9
Makefile
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Run go fmt against code
|
||||
fmt:
|
||||
go fmt ./...
|
||||
|
@ -20,3 +19,11 @@ tidy:
|
|||
test: tidy fmt vet
|
||||
go test ./... -coverprofile=coverage.out
|
||||
go tool cover -func=coverage.out
|
||||
|
||||
release:
|
||||
@version=$$(go run version/semver/main.go); \
|
||||
git tag -s $$version -m"Release $$version"
|
||||
goreleaser --rm-dist
|
||||
|
||||
test-release:
|
||||
goreleaser --skip-publish --snapshot --rm-dist
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
Synchronize [AdGuardHome](https://github.com/AdguardTeam/AdGuardHome) config to a replica instance.
|
||||
|
||||
This is still work in progress. Changes on how parameters are provided will change.
|
||||
|
||||
## Current sync features
|
||||
|
||||
- Filters
|
||||
|
|
1
go.mod
1
go.mod
|
@ -3,6 +3,7 @@ module github.com/bakito/adguardhome-sync
|
|||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/coreos/go-semver v0.3.0
|
||||
github.com/go-resty/resty/v2 v2.5.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
|
|
1
go.sum
1
go.sum
|
@ -28,6 +28,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf
|
|||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
|
|
49
version/semver/main.go
Normal file
49
version/semver/main.go
Normal file
|
@ -0,0 +1,49 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/coreos/go-semver/semver"
|
||||
)
|
||||
|
||||
func main() {
|
||||
out, err := exec.Command("git", "branch", "--show-current").Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
branch := strings.TrimSpace(string(out))
|
||||
if branch != "main" {
|
||||
panic(fmt.Errorf(`error: must be in "master" branch, current branch: %q`, branch))
|
||||
}
|
||||
|
||||
out, err = exec.Command("git", "describe").Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
version := strings.TrimPrefix(strings.TrimSpace(string(out)), "v")
|
||||
v := semver.New(version)
|
||||
v.BumpPatch()
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
if _, err = fmt.Fprintf(os.Stderr, "Enter Release Version: [v%v] ", v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
text, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if strings.HasPrefix(text, "v") {
|
||||
text = text[1:]
|
||||
v = semver.New(strings.TrimSpace(text))
|
||||
}
|
||||
|
||||
if _, err = fmt.Fprintf(os.Stderr, "Using Version: v%v\n", v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("v%v", v)
|
||||
}
|
6
version/version.go
Normal file
6
version/version.go
Normal file
|
@ -0,0 +1,6 @@
|
|||
package version
|
||||
|
||||
var (
|
||||
// Version the module version
|
||||
Version = "devel"
|
||||
)
|
Loading…
Reference in a new issue