diff --git a/bindown.yml b/bindown.yml index 1e68031..0245bef 100644 --- a/bindown.yml +++ b/bindown.yml @@ -6,10 +6,6 @@ systems: - linux/amd64 - windows/amd64 dependencies: - gh: - template: origin#gh - vars: - version: 2.29.0 go: template: origin#go vars: @@ -26,18 +22,6 @@ dependencies: template: origin#goreleaser vars: version: 1.18.2 - jq: - template: origin#jq - vars: - version: "1.6" - semver-next: - template: origin#semver-next - vars: - version: 2.0.0 - semver-prev: - template: origin#semver-prev - vars: - version: 0.0.1 shellcheck: template: origin#shellcheck vars: @@ -56,49 +40,6 @@ templates: bin: checksums.txt required_vars: - tag - origin#gh: - url: https://github.com/cli/cli/releases/download/v{{.version}}/gh_{{.version}}_{{.os}}_{{.arch}}{{.urlSuffix}} - archive_path: gh_{{.version}}_{{.os}}_{{.arch}}/bin/gh{{.archivePathSuffix}} - bin: gh - vars: - archivePathSuffix: "" - urlSuffix: .zip - overrides: - - matcher: - os: - - windows - dependency: - archive_path: bin/gh{{.archivePathSuffix}} - vars: - archivePathSuffix: .exe - - matcher: - os: - - linux - dependency: - vars: - urlSuffix: .tar.gz - - matcher: - os: - - darwin - version: - - < 2.28.0 - dependency: - vars: - urlSuffix: .tar.gz - substitutions: - os: - darwin: macOS - systems: - - darwin/amd64 - - darwin/arm64 - - linux/386 - - linux/amd64 - - linux/arm64 - - windows/386 - - windows/amd64 - - windows/arm64 - required_vars: - - version origin#go: url: https://dl.google.com/go/go{{.version}}.{{.os}}-{{.arch}}{{.urlSuffix}} archive_path: go/bin/go{{.archivePathSuffix}} @@ -230,93 +171,6 @@ templates: - windows/arm64 required_vars: - version - origin#jq: - url: https://github.com/stedolan/jq/releases/download/jq-{{.version}}/jq-{{.os}}{{.arch}}{{.extension}} - archive_path: jq-{{.os}}{{.arch}}{{.extension}} - bin: jq - vars: - extension: "" - overrides: - - matcher: - arch: - - amd64 - - arm64 - os: - - darwin - dependency: - url: https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64 - archive_path: jq-osx-amd64 - - matcher: - os: - - windows - dependency: - vars: - extension: .exe - substitutions: - arch: - "386": "32" - amd64: "64" - os: - windows: win - systems: - - linux/386 - - linux/amd64 - - darwin/amd64 - - darwin/arm64 - - windows/386 - - windows/amd64 - required_vars: - - version - origin#semver-next: - url: https://github.com/WillAbides/semver-next/releases/download/v{{.version}}/semver-next_{{.version}}_{{.os}}_{{.arch}}{{.urlSuffix}} - archive_path: semver-next{{.archivePathSuffix}} - bin: semver-next - vars: - archivePathSuffix: "" - urlSuffix: .tar.gz - overrides: - - matcher: - os: - - windows - dependency: - vars: - archivePathSuffix: .exe - systems: - - darwin/amd64 - - darwin/arm64 - - linux/386 - - linux/amd64 - - linux/arm64 - - windows/386 - - windows/amd64 - - windows/arm64 - required_vars: - - version - origin#semver-prev: - url: https://github.com/WillAbides/semver-prev/releases/download/v{{.version}}/semver-prev_{{.version}}_{{.os}}_{{.arch}}{{.urlSuffix}} - archive_path: semver-prev{{.archivePathSuffix}} - bin: semver-prev - vars: - archivePathSuffix: "" - urlSuffix: .tar.gz - overrides: - - matcher: - os: - - windows - dependency: - vars: - archivePathSuffix: .exe - systems: - - darwin/amd64 - - darwin/arm64 - - linux/386 - - linux/amd64 - - linux/arm64 - - windows/386 - - windows/amd64 - - windows/arm64 - required_vars: - - version origin#shellcheck: url: https://github.com/koalaman/shellcheck/releases/download/v{{.version}}/shellcheck-v{{.version}}.{{.os}}.{{.arch}}{{.urlSuffix}} archive_path: shellcheck-v{{.version}}/shellcheck{{.archivePathSuffix}} @@ -421,18 +275,6 @@ url_checksums: https://dl.google.com/go/go1.20.2.darwin-arm64.tar.gz: 7343c87f19e79c0063532e82e1c4d6f42175a32d99f7a4d15e658e88bf97f885 https://dl.google.com/go/go1.20.2.linux-amd64.tar.gz: 4eaea32f59cde4dc635fbc42161031d13e1c780b87097f4b4234cfce671f1768 https://dl.google.com/go/go1.20.2.windows-amd64.zip: fe439f0e438f7555a7f5f7194ddb6f4a07b0de1fa414385d19f2aeb26d9f43db - https://github.com/WillAbides/semver-next/releases/download/v2.0.0/semver-next_2.0.0_darwin_amd64.tar.gz: 2bb0e3a6fda58689c7c983c33f131b44298484ea42c95455f711b16e3a93d033 - https://github.com/WillAbides/semver-next/releases/download/v2.0.0/semver-next_2.0.0_darwin_arm64.tar.gz: d86b2a7e0cb21cd56b9168913994b4470be2c1a0d724d91c85d91aa3e8c63755 - https://github.com/WillAbides/semver-next/releases/download/v2.0.0/semver-next_2.0.0_linux_amd64.tar.gz: 336beb1eb6ce340a6dfbb61b7f3ffd8af821414112479a38f9b10db03dc7a6ea - https://github.com/WillAbides/semver-next/releases/download/v2.0.0/semver-next_2.0.0_windows_amd64.tar.gz: 2991941f5ab181a426789a8c3a33d999086ed21dba8a8ae7690f59b3c2dbb274 - https://github.com/WillAbides/semver-prev/releases/download/v0.0.1/semver-prev_0.0.1_darwin_amd64.tar.gz: de2902df5f99e6db91b143199446ccf9c7bdacd37980fca55f71e2da35211d0f - https://github.com/WillAbides/semver-prev/releases/download/v0.0.1/semver-prev_0.0.1_darwin_arm64.tar.gz: 367eaccc368bec6119d47cc78d0ad743cc8709dc1900e8f170c5314418c3a14e - https://github.com/WillAbides/semver-prev/releases/download/v0.0.1/semver-prev_0.0.1_linux_amd64.tar.gz: 1c1ab5926e9548659bdc1786cf1da9f62f80ae5314c5ccdf71123767e4f4da1d - https://github.com/WillAbides/semver-prev/releases/download/v0.0.1/semver-prev_0.0.1_windows_amd64.tar.gz: 31bc3527ad74cdfda9d5868287141f44e72e8fbd1709c4f6af05205f9eb8bb8b - https://github.com/cli/cli/releases/download/v2.29.0/gh_2.29.0_linux_amd64.tar.gz: 9fe05f43a11a7bf8eacf731422452d1997e6708d4160ef0efcb13c103320390e - https://github.com/cli/cli/releases/download/v2.29.0/gh_2.29.0_macOS_amd64.zip: e116d0f9c310450482cdcd7f4d2d1c7c4cab8d4f025a340260ce3f15329c5145 - https://github.com/cli/cli/releases/download/v2.29.0/gh_2.29.0_macOS_arm64.zip: 38ca9a355376abd1475362cf8b3cacf2a757198fe5fe70349cb1767666abacc6 - https://github.com/cli/cli/releases/download/v2.29.0/gh_2.29.0_windows_amd64.zip: 031eb343ebff6f8cc712d58d79267ee00b0c61b37d6698927161daae895044c6 https://github.com/golangci/golangci-lint/releases/download/v1.51.2/golangci-lint-1.51.2-darwin-amd64.tar.gz: 0549cbaa2df451cf3a2011a9d73a9cb127784d26749d9cd14c9f4818af104d44 https://github.com/golangci/golangci-lint/releases/download/v1.51.2/golangci-lint-1.51.2-darwin-arm64.tar.gz: 36e69882205a0e42a63ad57ec3015639c11051e03f0beb9cf7949c6451408960 https://github.com/golangci/golangci-lint/releases/download/v1.51.2/golangci-lint-1.51.2-linux-amd64.tar.gz: 4de479eb9d9bc29da51aec1834e7c255b333723d38dbd56781c68e5dddc6a90b @@ -455,6 +297,3 @@ url_checksums: https://github.com/mvdan/sh/releases/download/v3.6.0/shfmt_v3.6.0_darwin_arm64: 633f242246ee0a866c5f5df25cbf61b6af0d5e143555aca32950059cf13d91e0 https://github.com/mvdan/sh/releases/download/v3.6.0/shfmt_v3.6.0_linux_amd64: 5741a02a641de7e56b8da170e71a97e58050d66a3cf485fb268d6a5a8bb74afb https://github.com/mvdan/sh/releases/download/v3.6.0/shfmt_v3.6.0_windows_amd64.exe: 18122d910ba434be366588f37c302c309cde4ca5403f93285254a3cf96839d01 - https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64: af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44 - https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64: 5c0a0a3ea600f302ee458b30317425dd9632d1ad8882259fcaf4e9b868b2b1ef - https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe: a51d36968dcbdeabb3142c6f5cf9b401a65dc3a095f3144bd0c118d5bb192753 diff --git a/script/release b/script/release deleted file mode 100755 index 89a5edc..0000000 --- a/script/release +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -#/ script/release creates a new release. It is run by GitHub Actions on push to main. - -set -e - -CDPATH="" cd -- "$(dirname -- "$0")/.." - -if [ -f ".no-release" ]; then { - echo "Release disabled by .no-release file" - exit 0 -}; fi - -[ -n "$GITHUB_TOKEN" ] || { - echo GITHUB_TOKEN must be set - exit 1 -} - -if [ "$(git rev-parse --is-shallow-repository)" != "false" ]; then - echo "script/release cannot be run on a shallow clone" - exit 1 -fi - -script/bindown -q install semver-next -script/bindown -q install semver-prev -script/bindown -q install gh -script/bindown -q install jq - -git fetch --tags - -GITHUB_SHA="${GITHUB_SHA:-"$(git rev-parse HEAD)"}" -GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-"WillAbides/goproject-tmpl"}" - -PREV_REF="$(bin/semver-prev --prefix v --fallback "" --ref "$GITHUB_SHA")" -PREV_VERSION="$PREV_REF" -if [ -z "$PREV_REF" ]; then - PREV_REF="$(git rev-list --max-parents=0 HEAD)" - PREV_VERSION="0.0.0" -fi - -RES="$(bin/semver-next "$GITHUB_REPOSITORY" -r "$GITHUB_SHA" -p "$PREV_REF" -v "$PREV_VERSION" --json)" -NEXT_VERSION="$(echo "$RES" | bin/jq -r .next_version)" -CHANGE_LEVEL="$(echo "$RES" | bin/jq -r .change_level)" - -if [ "$CHANGE_LEVEL" = "no change" ]; then - echo "No changes since last release" - exit 0 -fi - -MODULE_NAME="$(go list -m)" -MAJOR_VERSION="$(echo "$NEXT_VERSION" | cut -d. -f1)" -MODULE_VERSION_SUFFIX="$(echo "$MODULE_NAME" | grep -o '/v[0-9][0-9]*$' || true)" - -# If MAJOR_VERSION >= 2, make sure the module name ends with `/v$MAJOR_VERSION` -if [ "$MAJOR_VERSION" -ge 2 ]; then - if [ "$MODULE_VERSION_SUFFIX" != "/v$MAJOR_VERSION" ]; then - echo "Module name must end with /v$MAJOR_VERSION" - exit 1 - fi -else - if [ -n "$MODULE_VERSION_SUFFIX" ]; then - echo "Module name must not end with /v[0-9][0-9]*" - exit 1 - fi -fi - -# pre-build so there isn't such a long time between creating the release and adding the assets -script/bindown -q install goreleaser -bin/goreleaser release --snapshot --clean - -bin/gh release create "v$NEXT_VERSION" -t "v$NEXT_VERSION" --generate-notes - -# now build for real -git fetch --tags -bin/goreleaser release --clean - -# create bootstrap-bindown.sh -go run ./internal/build-bootstrapper -tag "v$NEXT_VERSION" > bootstrap-bindown.sh -bin/gh release upload "v$NEXT_VERSION" bootstrap-bindown.sh