Skip to content

Commit

Permalink
fix: improve ci automation for release (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
Demonsthere authored Jul 26, 2023
1 parent a5aa267 commit b4638c1
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 48 deletions.
7 changes: 7 additions & 0 deletions .deps/helm-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1.11.0
url: https://github.com/norwoodj/helm-docs/releases/download/v{{.Version}}/helm-docs_{{.Version}}_{{.Os}}_{{.Architecture}}.tar.gz
# mappings:
# architecture:
# amd64: 64bit
# os:
# darwin: macOS
2 changes: 2 additions & 0 deletions .deps/k3d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version: v5.4.9
url: https://github.com/rancher/k3d/releases/download/{{.Version}}/k3d-{{.Os}}-{{.Architecture}}
2 changes: 2 additions & 0 deletions .deps/kubectl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version: v1.26.5
url: https://storage.googleapis.com/kubernetes-release/release/{{.Version}}/bin/{{.Os}}/{{.Architecture}}/kubectl
23 changes: 5 additions & 18 deletions .github/actions/deps-setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,11 @@ runs:
HELM_INSTALL_DIR: ${{ github.workspace }}/.bin
HELM_PLUGINS: ${{ github.workspace }}/.bin/plugins
K3D_INSTALL_DIR: ${{ github.workspace }}/.bin
KUBECTL_VERSION: "1.26.1"
K3D_VERSION: "5.4.4"
run: |
# Export .bin into PATH so k3d doesn't fail when installing
#Export .bin into PATH so k3d doesn't fail when installing
export PATH=".bin:$PATH"
echo "PATH=.bin:$PATH" >> $GITHUB_ENV
echo "PATH=.bin:$PATH" >> "$GITHUB_ENV"
make deps
echo "Downloading 'helm' 3...."
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
echo "Installing kubeval helm plugin"
mkdir .bin/plugins
helm plugin install https://github.com/instrumenta/helm-kubeval
echo "Installing k3d"
curl -s https://raw.githubusercontent.com/k3d-io/k3d/v${K3D_VERSION}/install.sh | USE_SUDO="false" bash
echo "Installing kubectl"
pushd .bin
curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
chmod +x ./kubectl
popd
mkdir .bin/plugins || true
helm plugin install https://github.com/instrumenta/helm-kubeval || true
16 changes: 6 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,14 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.ORY_BOT_PAT }}
- name: Generate documentation
shell: bash
run: |
pushd .bin
curl -L "https://github.com/norwoodj/helm-docs/releases/download/v${HELM_DOCS_VERSION}/helm-docs_${HELM_DOCS_VERSION}_Linux_x86_64.tar.gz" -o helm-docs.tar.gz
tar -xvf helm-docs.tar.gz
./helm-docs -c ../helm/charts
popd
- name: Push commit for release
- name: Checkout dependencies
uses: ./.github/actions/deps-setup
- name: Push commit
shell: bash
run: |
git config --global user.email "60093411+ory-bot@users.noreply.github.com"
git config --global user.name "ory-bot"
git checkout -b make-release HEAD
git checkout -b dirty HEAD
git add -A
git commit -m "Regenerate helm docs
Expand All @@ -212,6 +206,8 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.ORY_BOT_PAT }}
- name: Checkout dependencies
uses: ./.github/actions/deps-setup
- name: Define current tag version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV"
Expand Down
61 changes: 53 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
ifeq ($(OS),Windows_NT)
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
ARCH=amd64
OS=windows
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS=linux
ARCH=amd64
endif
ifeq ($(UNAME_S),Darwin)
OS=darwin
ifeq ($(shell uname -m),x86_64)
ARCH=amd64
endif
ifeq ($(shell uname -m),arm64)
ARCH=arm64
endif
endif
endif

SHELL=/bin/bash -euo pipefail

export PATH := .bin:${PATH}
Expand All @@ -12,11 +34,38 @@ export K3SIMAGE := docker.io/rancher/k3s:v1.26.1-k3s1
HELM_INSTALL_DIR=.bin bash <(curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3) -v v3.12.0 --no-sudo

.bin/ory: Makefile
curl https://raw.githubusercontent.com/ory/meta/master/install.sh | bash -s -- -b .bin ory v0.1.48
curl https://raw.githubusercontent.com/ory/meta/master/install.sh | bash -s -- -b .bin ory
touch .bin/ory

.bin/goimports:
GOBIN=$(shell pwd)/.bin go install golang.org/x/tools/cmd/goimports@latest

.bin/licenses: Makefile
curl https://raw.githubusercontent.com/ory/ci/master/licenses/install | sh

.bin/helm-docs: Makefile
@URL=$$(.bin/ory dev ci deps url -o ${OS} -a ${ARCH} -c .deps/helm-docs.yaml); \
echo "Downloading 'helm-docs' $${URL}...."; \
curl -L $${URL} | tar -xmz -C .bin helm-docs; \
chmod +x .bin/helm-docs;

.bin/k3d: Makefile
@URL=$$(.bin/ory dev ci deps url -o ${OS} -a ${ARCH} -c .deps/k3d.yaml); \
echo "Downloading 'k3d' $${URL}...."; \
curl -Lo .bin/k3d $${URL}; \
chmod +x .bin/k3d;

.bin/kubectl: Makefile
@URL=$$(.bin/ory dev ci deps url -o ${OS} -a ${ARCH} -c .deps/kubectl.yaml); \
echo "Downloading 'kubectl' $${URL}...."; \
curl -Lo .bin/kubectl $${URL}; \
chmod +x .bin/kubectl;

.PHONY: deps
deps: .bin/ory .bin/helm .bin/yq .bin/helm-docs .bin/k3d .bin/kubectl

.PHONY: release
release: .bin/yq .bin/helm
release:
yq w -i helm/charts/example-idp/Chart.yaml version "${VERSION}"
yq w -i helm/charts/hydra-maester/Chart.yaml version "${VERSION}"; \
yq w -i helm/charts/hydra/Chart.yaml version "${VERSION}"; \
Expand All @@ -38,6 +87,8 @@ release: .bin/yq .bin/helm
helm package -d docs/helm/charts/ ./helm/charts/keto/ --version "${VERSION}"; \
helm package -d docs/helm/charts/ ./helm/charts/kratos-selfservice-ui-node/ --version "${VERSION}"; \
helm repo index docs/helm/charts/
make helm-docs
make format

.PHONY: k3d-up
k3d-up:
Expand Down Expand Up @@ -119,12 +170,6 @@ format: .bin/goimports .bin/ory node_modules
licenses: .bin/licenses node_modules # checks open-source licenses
.bin/licenses

.bin/goimports:
GOBIN=$(shell pwd)/.bin go install golang.org/x/tools/cmd/goimports@latest

.bin/licenses: Makefile
curl https://raw.githubusercontent.com/ory/ci/master/licenses/install | sh

node_modules: package-lock.json
npm ci
touch node_modules
4 changes: 3 additions & 1 deletion helm/charts/example-idp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: v2
appVersion: "1.4.6"
description: A Helm chart for deploying the reference implementation for the User Login and Consent Flow in Kubernetes
description:
A Helm chart for deploying the reference implementation for the User Login and
Consent Flow in Kubernetes
name: example-idp
version: 0.34.0
type: application
2 changes: 1 addition & 1 deletion helm/charts/example-idp/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# example-idp

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.4.6](https://img.shields.io/badge/AppVersion-1.4.6-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.4.6](https://img.shields.io/badge/AppVersion-1.4.6-informational?style=flat-square)

A Helm chart for deploying the reference implementation for the User Login and Consent Flow in Kubernetes

Expand Down
2 changes: 1 addition & 1 deletion helm/charts/hydra-maester/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hydra-maester

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.0.28](https://img.shields.io/badge/AppVersion-v0.0.28-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.0.28](https://img.shields.io/badge/AppVersion-v0.0.28-informational?style=flat-square)

A Helm chart for Kubernetes

Expand Down
4 changes: 2 additions & 2 deletions helm/charts/hydra/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hydra

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.1.1](https://img.shields.io/badge/AppVersion-v2.1.1-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.1.1](https://img.shields.io/badge/AppVersion-v2.1.1-informational?style=flat-square)

A Helm chart for deploying ORY Hydra in Kubernetes

Expand All @@ -21,7 +21,7 @@ A Helm chart for deploying ORY Hydra in Kubernetes

| Repository | Name | Version |
|------------|------|---------|
| file://../hydra-maester | hydra-maester(hydra-maester) | 0.33.5 |
| file://../hydra-maester | hydra-maester(hydra-maester) | 0.34.0 |

## Values

Expand Down
2 changes: 1 addition & 1 deletion helm/charts/keto/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# keto

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.11.0](https://img.shields.io/badge/AppVersion-v0.11.0-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.11.0](https://img.shields.io/badge/AppVersion-v0.11.0-informational?style=flat-square)

Access Control Policies as a Server

Expand Down
2 changes: 1 addition & 1 deletion helm/charts/kratos-selfservice-ui-node/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kratos-selfservice-ui-node

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.10.1](https://img.shields.io/badge/AppVersion-v0.10.1-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.10.1](https://img.shields.io/badge/AppVersion-v0.10.1-informational?style=flat-square)

A Helm chart for ORY Kratos's example ui for Kubernetes

Expand Down
2 changes: 1 addition & 1 deletion helm/charts/kratos/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kratos

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.13.0](https://img.shields.io/badge/AppVersion-v0.13.0-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.13.0](https://img.shields.io/badge/AppVersion-v0.13.0-informational?style=flat-square)

A ORY Kratos Helm chart for Kubernetes

Expand Down
3 changes: 2 additions & 1 deletion helm/charts/oathkeeper-maester/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apiVersion: v1
appVersion: "v0.1.8"
description: A Helm chart for deploying ORY Oathkeeper Rule Controller in Kubernetes
description:
A Helm chart for deploying ORY Oathkeeper Rule Controller in Kubernetes
name: oathkeeper-maester
icon: https://raw.githubusercontent.com/ory/docs/master/docs/static/img/logo-oathkeeper.svg
version: 0.34.0
Expand Down
2 changes: 1 addition & 1 deletion helm/charts/oathkeeper-maester/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# oathkeeper-maester

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![AppVersion: v0.1.8](https://img.shields.io/badge/AppVersion-v0.1.8-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![AppVersion: v0.1.8](https://img.shields.io/badge/AppVersion-v0.1.8-informational?style=flat-square)

A Helm chart for deploying ORY Oathkeeper Rule Controller in Kubernetes

Expand Down
4 changes: 2 additions & 2 deletions helm/charts/oathkeeper/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# oathkeeper

![Version: 0.33.5](https://img.shields.io/badge/Version-0.33.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.40.3](https://img.shields.io/badge/AppVersion-v0.40.3-informational?style=flat-square)
![Version: 0.34.0](https://img.shields.io/badge/Version-0.34.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.40.3](https://img.shields.io/badge/AppVersion-v0.40.3-informational?style=flat-square)

A Helm chart for deploying ORY Oathkeeper in Kubernetes

Expand All @@ -21,7 +21,7 @@ A Helm chart for deploying ORY Oathkeeper in Kubernetes

| Repository | Name | Version |
|------------|------|---------|
| file://../oathkeeper-maester | oathkeeper-maester(oathkeeper-maester) | 0.33.5 |
| file://../oathkeeper-maester | oathkeeper-maester(oathkeeper-maester) | 0.34.0 |

## Values

Expand Down

0 comments on commit b4638c1

Please sign in to comment.