diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6e7186b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: goreleaser + +on: + push: + tags: + - "*" + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v4 + with: + go-version: stable + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 82c4ca1..1fde897 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ # Go workspace file go.work -.idea \ No newline at end of file +.idea +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..ad7c7ad --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,32 @@ +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +archives: + - replacements: + darwin: macOS + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +dockers: + - image_templates: + - leslieleung/gin-application-template:{{ .Tag }} + - leslieleung/gin-application-template:latest +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 64cc3a9..f94b0bb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ The following features have already been implemented to simplify the initializat - [x] Makefile(run, dry-run) - [x] Gin Server - [x] Config Management -- [ ] Goreleaser (GitHub Actions) +- [x] Goreleaser (GitHub Actions) - [x] API Documentation (Swagger) - [ ] Database Connection -- [ ] Logging \ No newline at end of file +- [ ] Logging +- [ ] i18n Support \ No newline at end of file diff --git a/go.mod b/go.mod index 739a0b8..0526b47 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.21 require ( github.com/gin-gonic/gin v1.9.1 + github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.17.0 github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 @@ -46,7 +47,6 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect