template / commit
Merge branch 'choco' into 'main'
.gitlab-ci.yml | 28 +++----------- .goreleaser.yaml | 113 ------------------------------------------------------- Makefile | 22 +++++------ 3 files changed, 14 insertions(+), 149 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c600625..36c6f15 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,38 +1,23 @@ # Copied from # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml -.shared_windows_runners: - tags: - - shared-windows - - windows - - windows-1809 +image: golang:1.19 stages: # List of stages for jobs, and their order of execution - build-and-test - release before_script: - - Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" - - Set-Variable -Name "time" -Value (date -Format "%H:%m") - - echo ${time} - - echo "started by ${GITLAB_USER_NAME}" - - choco upgrade chocolatey -y - - choco upgrade golang -y - - refreshenv - go version - - choco install make - make --version + - make dev-setup build-job: - extends: - - .shared_windows_runners stage: build-and-test script: - make all release: - extends: - - .shared_windows_runners stage: release image: docker:stable services: @@ -43,13 +28,10 @@ release: # generate a changelog. GIT_DEPTH: 0 - # TEMPORARILY RUN THIS RELEASE JOB FOR EVERY COMMIT. - # TODO: REMOVE ASAP # Only run this release job for tags, not every commit (for example). only: - - main - # refs: - # - tags + refs: + - tags - script: + script: - make release \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 24d1610..a6a68ba 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -97,116 +97,3 @@ brews: # Default is empty. post_install: | system "#{bin}/template reset" -chocolateys: - - - # Your app's package name. - # The value may not contain spaces or character that are not valid for a URL. - # If you want a good separator for words, use '-', not '.'. - # - # Defaults to `ProjectName`. - name: template - - # Your app's owner. - # It basically means your. - # Defaults empty. - owners: PavelSafronov - - # The app's title. - # A human-friendly title of the package. - # Defaults to `ProjectName`. - title: Template - - # Your app's authors (probably you). - # Defaults are shown below. - authors: PavelSafronov - - # Your app's project url. - # It is a required field. - project_url: https://gitlab.com/PavelSafronov/template - - # Template for the url which is determined by the given Token (github, - # gitlab or gitea) - # Default depends on the client. - # url_template: "https://github.com/foo/bar/releases/download/{{ .Tag }}/{{ .ArtifactName }}" - # https://gitlab.com/PavelSafronov/template/-/releases/v0.1.17/downloads/template_0.1.17_Linux_i386.tar.gz - url_template: "https://gitlab.com/PavelSafronov/template/-/releases/{{ .Tag }}/downloads/{{ .ArtifactName }}" - - # # App's icon. - # # Default is empty. - # icon_url: 'https://rawcdn.githack.com/foo/bar/efbdc760-395b-43f1-bf69-ba25c374d473/icon.png' - - # Your app's copyright details. - # Default is empty. - copyright: 2023 PavelSafronov - - # App's license information url. - license_url: https://gitlab.com/PavelSafronov/template/-/blob/main/LICENSE - - # Your apps's require license acceptance: - # Specify whether the client must prompt the consumer to accept the package - # license before installing. - # Default is false. - require_license_acceptance: false - - # Your app's source url. - # Default is empty. - # project_source_url: https://gitlab.com/PavelSafronov/template - - package_source_url: https://gitlab.com/PavelSafronov/template - - # Your app's documentation url. - # Default is empty. - docs_url: https://gitlab.com/PavelSafronov/template/-/blob/main/README.md - - # App's bugtracker url. - # Default is empty. - bug_tracker_url: https://gitlab.com/PavelSafronov/template/-/issues - - # Your app's tag list. - # Default is empty. - tags: "template" - - # Your app's summary: - summary: This CLI creates files and folders with generated templated names and contents. - - # This the description of your chocolatey package. - # Supports markdown. - description: | - {{ .ProjectName }} installer package. - This CLI creates files and folders with generated templated names and contents. - - # Your app's release notes. - # A description of the changes made in this release of the package. - # Supports markdown. To prevent the need to continually update this field, - # providing a URL to an external list of Release Notes is perfectly - # acceptable. - # Default is empty. - # https://gitlab.com/PavelSafronov/template/-/releases/v0.1.21 - # release_notes: "https://github.com/foo/bar/releases/tag/v{{ .Version }}" - release_notes: "https://gitlab.com/PavelSafronov/template/-/releases/v{{ .Version }}" - - # # App's dependencies - # # Default is empty. Version is not required. - # dependencies: - # - id: nfpm - # version: 2.20.0 - - # The api key that should be used to push to the chocolatey repository. - # - # WARNING: do not expose your api key in the configuration file! - api_key: '{{ .Env.CHOCOLATEY_API_KEY }}' - - # The source repository that will push the package to. - # - # Defaults are shown below. - source_repo: "https://push.chocolatey.org/" - - # Setting this will prevent goreleaser to actually try to push the package - # to chocolatey repository, leaving the responsability of publishing it to - # the user. - skip_publish: false - - # GOAMD64 to specify which amd64 version to use if there are multiple - # versions from the build section. - # Default is v1. - goamd64: v1 diff --git a/Makefile b/Makefile index 2ac9082..9cc8449 100644 --- a/Makefile +++ b/Makefile @@ -6,18 +6,23 @@ LDFLAGS=-ldflags "-w -s -X main.Version=${VERSION}" all: build test lint +dev-setup: + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + golangci-lint --version + go install github.com/goreleaser/goreleaser@latest + goreleaser --version + prep: go mod tidy clean: go clean + go mod tidy build: prep go build ${LDFLAGS} -o ${BINARY} . lint: build - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - golangci-lint --version golangci-lint run --timeout=10m test: build @@ -37,16 +42,7 @@ uninstall: go clean -i gitlab.com/PavelSafronov/template... if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi -release-dry-run: build test lint - go install github.com/goreleaser/goreleaser@latest - goreleaser release --snapshot --rm-dist - -release-local: build test lint - go install github.com/goreleaser/goreleaser@latest - goreleaser build --single-target - -release: build test lint - go install github.com/goreleaser/goreleaser@latest +release: all git restore go.mod goreleaser release --clean @@ -56,4 +52,4 @@ brew-install: brew-uninstall: brew uninstall template - brew untap PavelSafronov/template \ No newline at end of file + brew untap PavelSafronov/template