Skip to content

Commit

Permalink
Release script (#15)
Browse files Browse the repository at this point in the history
* Dummy change (#13)

* Add goreleaser config

* Add goreleaser config

* Use only goreleaser

* Update release script

* Remove manifests generation from release build

* Tidy script
  • Loading branch information
werdes72 authored Sep 8, 2022
1 parent f5712aa commit 1ea953f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 54 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ info.json
*.tmpl-e

# Vscode directory
.vscode
.vscode
dist/
37 changes: 37 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Documentation for how to configure goreleaser can be found at http://goreleaser.com
project_name: api-gateway
release:
github:
owner: kyma-project
name: api-gateway
prerelease: auto
builds:
- env:
- CGO_ENABLED=0
main: ./
goos:
- darwin
- linux
- windows
ignore:
- goos: darwin
goarch: 386
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
env_files:
github_token: /etc/github/token
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ vet: ## Run go vet against code.
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out

.PHONY: test-for-release
test-for-release: fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out

##@ Build

Expand All @@ -120,6 +123,10 @@ run: build
docker-build: pull-licenses test ## Build docker image with the manager.
docker build -t $(APP_NAME):latest .

.PHONY: docker-build-release
docker-build-release: pull-licenses test-for-release ## Build docker image with the manager.
docker build -t $(APP_NAME):latest .

.PHONY: docker-build-certificates
docker-build-certificates: ## Build docker image for certificates management
docker build -f Dockerfile-certificates -t $(CERTIFICATES_APP_NAME):latest .
Expand Down
22 changes: 0 additions & 22 deletions config/crd/bases/gateway.kyma-project.io_apirules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ spec:
keys vary per handler.
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
jwks_urls:
type: array
items:
type: string
pattern: ^(https://|file://).*$
trusted_issuers:
type: array
items:
type: string
pattern: ^(https://|file://).*$
handler:
description: Name is the name of a handler
type: string
Expand Down Expand Up @@ -234,17 +223,6 @@ spec:
keys vary per handler.
type: object
x-kubernetes-preserve-unknown-fields: true
properties:
jwks_urls:
type: array
items:
type: string
pattern: ^(https://|file://).*$
trusted_issuers:
type: array
items:
type: string
pattern: ^(https://|file://).*$
handler:
description: Name is the name of a handler
type: string
Expand Down
33 changes: 2 additions & 31 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,10 @@ set -E # needs to be set if we want the ERR trap

readonly API_GATEWAY_DIR="/home/prow/go/src/github.com/kyma-project/api-gateway"

# locally delete the stable tag in order to have all the change logs listed under the new release version
delete_stable_tag() {
if [[ $(git tag -l stable) ]]; then
git tag -d stable
fi
}

get_new_release_version() {
# get the list of tags in a reverse chronological order
TAG_LIST=($(git tag --sort=-creatordate))
NEW_RELEASE_VERSION=${TAG_LIST[0]}
}

get_current_release_version() {
# get the list of tags in a reverse chronological order excluding release candidate tags
TAG_LIST_WITHOUT_RC=($(git tag --sort=-creatordate | grep -v -e "-rc"))
if [[ $NEW_RELEASE_VERSION == *"-rc"* ]]; then
CURRENT_RELEASE_VERSION=${TAG_LIST_WITHOUT_RC[0]}
else
CURRENT_RELEASE_VERSION=${TAG_LIST_WITHOUT_RC[1]}
fi
}

main() {
git remote add origin git@github.com:kyma-project/api-gateway.git
delete_stable_tag
get_new_release_version
get_current_release_version

# generate release changelog
docker run --rm -v "${API_GATEWAY_DIR}":/repository -w /repository -e FROM_TAG="${CURRENT_RELEASE_VERSION}" -e NEW_RELEASE_TITLE="${NEW_RELEASE_VERSION}" -e GITHUB_AUTH="${BOT_GITHUB_TOKEN}" -e CONFIG_FILE=.github/package.json eu.gcr.io/kyma-project/changelog-generator:0.2.0 sh /app/generate-release-changelog.sh
# release api-gateway with release notes generated by changelog-generator
curl -sL https://git.io/goreleaser | VERSION=v0.118.2 bash -s -- --release-notes .changelog/release-changelog.md
# release api-gateway with goreleaser
curl -sL https://git.io/goreleaser | VERSION=v1.11.2 bash -s --
}

main

0 comments on commit 1ea953f

Please sign in to comment.