mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 02:21:49 +03:00
chore: also set version to helm charts in set-version.sh (#5100)
This commit is contained in:
parent
df439877bd
commit
e93b497231
4
.github/actions/deploy/deploy.mjs
vendored
4
.github/actions/deploy/deploy.mjs
vendored
@ -1,6 +1,7 @@
|
|||||||
import { execSync } from 'node:child_process';
|
import { execSync } from 'node:child_process';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
APP_VERSION,
|
||||||
BUILD_TYPE,
|
BUILD_TYPE,
|
||||||
DEPLOY_HOST,
|
DEPLOY_HOST,
|
||||||
CANARY_DEPLOY_HOST,
|
CANARY_DEPLOY_HOST,
|
||||||
@ -79,6 +80,7 @@ const createHelmCommand = ({ isDryRun }) => {
|
|||||||
`--set global.ingress.enabled=true`,
|
`--set global.ingress.enabled=true`,
|
||||||
`--set-json global.ingress.annotations=\"{ \\"kubernetes.io/ingress.class\\": \\"gce\\", \\"kubernetes.io/ingress.allow-http\\": \\"true\\", \\"kubernetes.io/ingress.global-static-ip-name\\": \\"${staticIpName}\\" }\"`,
|
`--set-json global.ingress.annotations=\"{ \\"kubernetes.io/ingress.class\\": \\"gce\\", \\"kubernetes.io/ingress.allow-http\\": \\"true\\", \\"kubernetes.io/ingress.global-static-ip-name\\": \\"${staticIpName}\\" }\"`,
|
||||||
`--set-string global.ingress.host="${host}"`,
|
`--set-string global.ingress.host="${host}"`,
|
||||||
|
`--set-string global.version="${APP_VERSION}"`,
|
||||||
...redisAndPostgres,
|
...redisAndPostgres,
|
||||||
`--set web.replicaCount=${webReplicaCount}`,
|
`--set web.replicaCount=${webReplicaCount}`,
|
||||||
`--set-string web.image.tag="${imageTag}"`,
|
`--set-string web.image.tag="${imageTag}"`,
|
||||||
@ -105,7 +107,7 @@ const createHelmCommand = ({ isDryRun }) => {
|
|||||||
`--set sync.replicaCount=${syncReplicaCount}`,
|
`--set sync.replicaCount=${syncReplicaCount}`,
|
||||||
`--set-string sync.image.tag="${imageTag}"`,
|
`--set-string sync.image.tag="${imageTag}"`,
|
||||||
...serviceAnnotations,
|
...serviceAnnotations,
|
||||||
`--version "0.0.0-${buildType}.${GIT_SHORT_HASH}" --timeout 10m`,
|
`--timeout 10m`,
|
||||||
flag,
|
flag,
|
||||||
].join(' ');
|
].join(' ');
|
||||||
return deployCommand;
|
return deployCommand;
|
||||||
|
2
.github/helm/affine/Chart.yaml
vendored
2
.github/helm/affine/Chart.yaml
vendored
@ -3,4 +3,4 @@ name: affine
|
|||||||
description: AFFiNE cloud chart
|
description: AFFiNE cloud chart
|
||||||
type: application
|
type: application
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
appVersion: '0.7.0-canary.18'
|
appVersion: "0.10.3-canary.2"
|
||||||
|
@ -3,4 +3,4 @@ name: graphql
|
|||||||
description: AFFiNE GraphQL server
|
description: AFFiNE GraphQL server
|
||||||
type: application
|
type: application
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
appVersion: '0.7.0-canary.18'
|
appVersion: "0.10.3-canary.2"
|
||||||
|
2
.github/helm/affine/charts/sync/Chart.yaml
vendored
2
.github/helm/affine/charts/sync/Chart.yaml
vendored
@ -3,4 +3,4 @@ name: sync
|
|||||||
description: A Helm chart for Kubernetes
|
description: A Helm chart for Kubernetes
|
||||||
type: application
|
type: application
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
appVersion: "0.7.0-canary.18"
|
appVersion: "0.10.3-canary.2"
|
||||||
|
7
.github/workflows/deploy.yml
vendored
7
.github/workflows/deploy.yml
vendored
@ -207,6 +207,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- name: setup deploy version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
export APP_VERSION=`node -e "console.log(require('./package.json').version)"`
|
||||||
|
echo $APP_VERSION
|
||||||
|
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
- name: Deploy to ${{ github.event.inputs.flavor }}
|
- name: Deploy to ${{ github.event.inputs.flavor }}
|
||||||
uses: ./.github/actions/deploy
|
uses: ./.github/actions/deploy
|
||||||
with:
|
with:
|
||||||
@ -217,6 +223,7 @@ jobs:
|
|||||||
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
|
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
|
||||||
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
|
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
|
||||||
env:
|
env:
|
||||||
|
APP_VERSION: ${{ steps.version.outputs.APP_VERSION }}
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
||||||
CANARY_DEPLOY_HOST: ${{ secrets.CANARY_DEPLOY_HOST }}
|
CANARY_DEPLOY_HOST: ${{ secrets.CANARY_DEPLOY_HOST }}
|
||||||
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
|
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
|
||||||
|
@ -6,3 +6,35 @@ for DIR in $(yarn workspaces list --json | jq -r '.location'); do
|
|||||||
jq ".version = \"$1\"" "$DIR"/package.json > tmp.json && mv tmp.json "$DIR"/package.json
|
jq ".version = \"$1\"" "$DIR"/package.json > tmp.json && mv tmp.json "$DIR"/package.json
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
update_app_version_in_helm_charts() {
|
||||||
|
local file_path=$1
|
||||||
|
local new_version=$2
|
||||||
|
|
||||||
|
# Check if file exists
|
||||||
|
if [ ! -f "$file_path" ]; then
|
||||||
|
echo "Error: File does not exist at $file_path."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Updating $file_path with appVersion $new_version"
|
||||||
|
|
||||||
|
# Use sed to replace the appVersion value with the new version.
|
||||||
|
sed -i.bak -E "s/^appVersion:[[:space:]]+[\"']?.*[\"']?$/appVersion: \"$new_version\"/" "$file_path"
|
||||||
|
|
||||||
|
# Check if sed command succeeded
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error: Failed to update the appVersion."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "appVersion in $file_path updated to $new_version"
|
||||||
|
|
||||||
|
rm "$file_path".bak
|
||||||
|
}
|
||||||
|
|
||||||
|
new_version=$1
|
||||||
|
|
||||||
|
update_app_version_in_helm_charts ".github/helm/affine/Chart.yaml" "$new_version"
|
||||||
|
update_app_version_in_helm_charts ".github/helm/affine/charts/graphql/Chart.yaml" "$new_version"
|
||||||
|
update_app_version_in_helm_charts ".github/helm/affine/charts/sync/Chart.yaml" "$new_version"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@affine/commitlint-config",
|
"name": "@affine/commitlint-config",
|
||||||
"version": "0.0.0",
|
"version": "0.10.3-canary.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^18.4.3",
|
"@commitlint/cli": "^18.4.3",
|
||||||
|
Loading…
Reference in New Issue
Block a user