mirror of
https://github.com/foomo/gocontentful.git
synced 2025-10-16 12:25:39 +00:00
chore: add release workflow
This commit is contained in:
parent
6a3be467c5
commit
6f659f80b9
37
.github/workflows/release.yml
vendored
Normal file
37
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*.*.*
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GOFLAGS: -mod=readonly
|
||||
GOPROXY: https://proxy.golang.org
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
|
||||
# TODO enable
|
||||
#- name: golangci-lint
|
||||
# uses: golangci/golangci-lint-action@v2
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,3 +10,5 @@
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
bin
|
||||
85
.golangci.yml
Normal file
85
.golangci.yml
Normal file
@ -0,0 +1,85 @@
|
||||
run:
|
||||
timeout: 5m
|
||||
|
||||
linters-settings:
|
||||
gci:
|
||||
local-prefixes: github.com/foomo/gocontentful
|
||||
golint:
|
||||
min-confidence: 0
|
||||
goimports:
|
||||
local-prefixes: github.com/foomo/gocontentful
|
||||
gocritic:
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- style
|
||||
disabled-tags:
|
||||
- performance
|
||||
- experimental
|
||||
- opinionated
|
||||
lll:
|
||||
line-length: 150
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- bodyclose
|
||||
- deadcode
|
||||
- dogsled
|
||||
- dupl
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- gci
|
||||
- goconst
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goimports
|
||||
- revive
|
||||
- goprintffuncname
|
||||
- govet
|
||||
- ineffassign
|
||||
- misspell
|
||||
- nakedret
|
||||
- noctx
|
||||
- nolintlint
|
||||
- prealloc
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- stylecheck
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- varcheck
|
||||
- whitespace
|
||||
- errcheck
|
||||
- gocritic
|
||||
- gosimple
|
||||
|
||||
- gocyclo
|
||||
- gosec
|
||||
- lll
|
||||
- exportloopref
|
||||
|
||||
# unused
|
||||
# - godot
|
||||
# - gocognit
|
||||
# - nlreturn
|
||||
# - gochecknoglobals
|
||||
# - gochecknoinits
|
||||
# - depguard
|
||||
# - goheader
|
||||
# - gomodguard
|
||||
|
||||
# don't enable:
|
||||
# - asciicheck
|
||||
# - funlen
|
||||
# - godox
|
||||
# - goerr113
|
||||
# - gomnd
|
||||
# - interfacer
|
||||
# - maligned
|
||||
# - nestif
|
||||
# - testpackage
|
||||
# - wsl
|
||||
31
.goreleaser.yml
Normal file
31
.goreleaser.yml
Normal file
@ -0,0 +1,31 @@
|
||||
# .goreleaser.yml
|
||||
# Build customization
|
||||
builds:
|
||||
- binary: gocontentful
|
||||
main: ./cmd/main.go
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -s -w -X github.com/foomo/gocontentful/VERSION={{.Version}}
|
||||
goos:
|
||||
- windows
|
||||
- darwin
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
|
||||
# .goreleaser.yml
|
||||
archives:
|
||||
- format: tar.gz
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
brews:
|
||||
# Reporitory to push the tap to.
|
||||
- tap:
|
||||
owner: foomo
|
||||
name: homebrew-gocontentful
|
||||
caveats: "gocontentful -h"
|
||||
homepage: "https://github.com/foomo/gocontentful"
|
||||
description: "An Contentful Entry-Reference Mapper for Go"
|
||||
62
Makefile
Normal file
62
Makefile
Normal file
@ -0,0 +1,62 @@
|
||||
.DEFAULT_GOAL:=help
|
||||
|
||||
## === Tasks ===
|
||||
|
||||
## Install binary
|
||||
install:
|
||||
go build -o ${GOPATH}/bin/gocontenful main.go
|
||||
|
||||
## Build binary
|
||||
build:
|
||||
mkdir -p bin
|
||||
go build -o bin/gocontenful main.go
|
||||
|
||||
.PHONY: test
|
||||
## Run tests
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
.PHONY: lint
|
||||
## Run linter
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: lint.fix
|
||||
## Fix lint violations
|
||||
lint.fix:
|
||||
golangci-lint run --fix
|
||||
|
||||
|
||||
## === Utils ===
|
||||
|
||||
## Show help text
|
||||
help:
|
||||
@awk '{ \
|
||||
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
|
||||
helpCommand = substr($$0, index($$0, ":") + 2); \
|
||||
if (helpMessage) { \
|
||||
printf "\033[36m%-23s\033[0m %s\n", \
|
||||
helpCommand, helpMessage; \
|
||||
helpMessage = ""; \
|
||||
} \
|
||||
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
|
||||
helpCommand = substr($$0, 0, index($$0, ":")); \
|
||||
if (helpMessage) { \
|
||||
printf "\033[36m%-23s\033[0m %s\n", \
|
||||
helpCommand, helpMessage"\n"; \
|
||||
helpMessage = ""; \
|
||||
} \
|
||||
} else if ($$0 ~ /^##/) { \
|
||||
if (helpMessage) { \
|
||||
helpMessage = helpMessage"\n "substr($$0, 3); \
|
||||
} else { \
|
||||
helpMessage = substr($$0, 3); \
|
||||
} \
|
||||
} else { \
|
||||
if (helpMessage) { \
|
||||
print "\n "helpMessage"\n" \
|
||||
} \
|
||||
helpMessage = ""; \
|
||||
} \
|
||||
}' \
|
||||
$(MAKEFILE_LIST)
|
||||
24
README.md
24
README.md
@ -27,11 +27,25 @@ Quickstart
|
||||
|
||||
Prerequisite: you need Go 1.16+. Upgrade if you still haven't, then run:
|
||||
|
||||
> go get github.com/foomo/gocontentful
|
||||
```bash
|
||||
go get github.com/foomo/gocontentful
|
||||
```
|
||||
|
||||
If you trust us there are precompiled versions:
|
||||
|
||||
[releases](https://github.com/foomo/gocontentful/releases)
|
||||
|
||||
On the mac:
|
||||
|
||||
```bash
|
||||
brew install foomo/gocontentful/gocontentful
|
||||
```
|
||||
|
||||
Test the installation (make sure $GOPATH/bin is in your $PATH):
|
||||
|
||||
>gocontentful
|
||||
```bash
|
||||
gocontentful
|
||||
```
|
||||
|
||||
<pre><code>Contentful API Generator starting...
|
||||
|
||||
@ -51,13 +65,15 @@ Usage of gocontentful:
|
||||
Note: The last segment of the path/to/target/package will be used as package name
|
||||
</code></pre>
|
||||
|
||||
###Use case
|
||||
### Use case
|
||||
|
||||
- You want to generate a package named "people" and manipulate entries of content types with ID "person" and "pet".
|
||||
|
||||
Run the following:
|
||||
|
||||
>gocontentful -spaceid YOUR_SPACE_ID -cmakey YOUR_CMA_API_TOKEN -contenttypes person,pet path/to/your/go/project/folder/people
|
||||
```bash
|
||||
gocontentful -spaceid YOUR_SPACE_ID -cmakey YOUR_CMA_API_TOKEN -contenttypes person,pet path/to/your/go/project/folder/people
|
||||
```
|
||||
|
||||
The -contenttypes parameter is optional. If not specified, an API for all content types of the space will be generated.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user