Compare commits

..

2 Commits

Author SHA1 Message Date
Satinder Singh
53df2c2704 fix: add semantic versioning for helm charts (#2603) 2024-01-14 09:44:16 +08:00
Yang Luo
78066da208 Improve setCorsHeaders() for "include" mode 2024-01-13 23:46:05 +08:00
2 changed files with 10 additions and 11 deletions

View File

@@ -217,13 +217,9 @@ jobs:
- name: Update Helm Chart - name: Update Helm Chart
if: steps.should_push.outputs.push=='true' if: steps.should_push.outputs.push=='true'
run: | run: |
# Set the appVersion of the chart to the current tag # Set the appVersion and version of the chart to the current tag
sed -i "s/appVersion: .*/appVersion: ${{steps.get-current-tag.outputs.tag }}/g" ./charts/casdoor/Chart.yaml sed -i "s/appVersion: .*/appVersion: ${{steps.get-current-tag.outputs.tag }}/g" ./charts/casdoor/Chart.yaml
sed -i "s/version: .*/version: ${{steps.get-current-tag.outputs.tag }}/g" ./charts/casdoor/Chart.yaml
# increase the patch version of the chart
currentChartVersion=$(cat ./charts/casdoor/Chart.yaml | grep ^version | awk '{print $2}')
newChartVersion=$(echo $currentChartVersion | awk -F. -v OFS=. '{$NF++;print}')
sed -i "s/version: .*/version: $newChartVersion/g" ./charts/casdoor/Chart.yaml
REGISTRY=oci://registry-1.docker.io/casbin REGISTRY=oci://registry-1.docker.io/casbin
cd charts/casdoor cd charts/casdoor
@@ -238,4 +234,5 @@ jobs:
git config --global user.email "bot@casbin.org" git config --global user.email "bot@casbin.org"
git add Chart.yaml index.yaml git add Chart.yaml index.yaml
git commit -m "chore(helm): bump helm charts appVersion to ${{steps.get-current-tag.outputs.tag }}" git commit -m "chore(helm): bump helm charts appVersion to ${{steps.get-current-tag.outputs.tag }}"
git push origin HEAD:master git tag ${{steps.get-current-tag.outputs.tag }}
git push origin HEAD:master --follow-tags

View File

@@ -24,16 +24,18 @@ import (
) )
const ( const (
headerOrigin = "Origin" headerOrigin = "Origin"
headerAllowOrigin = "Access-Control-Allow-Origin" headerAllowOrigin = "Access-Control-Allow-Origin"
headerAllowMethods = "Access-Control-Allow-Methods" headerAllowMethods = "Access-Control-Allow-Methods"
headerAllowHeaders = "Access-Control-Allow-Headers" headerAllowHeaders = "Access-Control-Allow-Headers"
headerAllowCredentials = "Access-Control-Allow-Credentials"
) )
func setCorsHeaders(ctx *context.Context, origin string) { func setCorsHeaders(ctx *context.Context, origin string) {
ctx.Output.Header(headerAllowOrigin, origin) ctx.Output.Header(headerAllowOrigin, origin)
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS, DELETE") ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS, DELETE")
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization") ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
ctx.Output.Header(headerAllowCredentials, "true")
if ctx.Input.Method() == "OPTIONS" { if ctx.Input.Method() == "OPTIONS" {
ctx.ResponseWriter.WriteHeader(http.StatusOK) ctx.ResponseWriter.WriteHeader(http.StatusOK)