mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 21:47:23 +00:00
parent
207842be91
commit
654bf09ed1
54
.github/scripts/githelper.sh
vendored
Executable file
54
.github/scripts/githelper.sh
vendored
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
#debugger
|
||||
set -x
|
||||
|
||||
source ./.github/scripts/variables.env
|
||||
|
||||
############################
|
||||
function setup_git {
|
||||
############################
|
||||
echo "###############"
|
||||
echo "set git config"
|
||||
echo "###############"
|
||||
|
||||
git config --global user.email "$GIT_USER_MAIL"
|
||||
git config --global user.name "$GIT_USER_NAME"
|
||||
}
|
||||
|
||||
############################
|
||||
function checkout_project {
|
||||
############################
|
||||
echo "###############"
|
||||
echo "clone repository $GIT_URL"
|
||||
echo "###############"
|
||||
|
||||
# clone opsrepo
|
||||
git clone $GIT_URL $LOCAL_TMP_DIR/$GIT_OPSREPO
|
||||
}
|
||||
|
||||
############################
|
||||
function change_image_version {
|
||||
############################
|
||||
echo "###############"
|
||||
echo "checkout master"
|
||||
echo "###############"
|
||||
|
||||
cd $LOCAL_TMP_DIR/$GIT_OPSREPO/$GIT_OPSREPO_APPFOLDER/$GIT_OPSREPO_APPLICATION_NAME/overlay/$TARGET_ENVIRONMENT
|
||||
git checkout master
|
||||
git pull
|
||||
echo "###############"
|
||||
echo "change image version and commit"
|
||||
echo "###############"
|
||||
sed -i "s#image: $REGISTRY_IMAGE:.*#image: $REGISTRY_IMAGE:$CAOS_NEXT_VERSION#g" $GIT_OPSREPO_IMAGEFILE
|
||||
git add $GIT_OPSREPO_IMAGEFILE
|
||||
git commit --message "Github Workflow: $GITHUB_WORKFLOW"
|
||||
}
|
||||
|
||||
############################
|
||||
function upload_files {
|
||||
############################
|
||||
echo "###############"
|
||||
echo "git push"
|
||||
echo "###############"
|
||||
git push --quiet --set-upstream origin
|
||||
}
|
21
.github/scripts/variables.env
vendored
Normal file
21
.github/scripts/variables.env
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
### local vars
|
||||
export LOCAL_TMP_DIR="/tmp"
|
||||
|
||||
### git settings for cloning operations repository
|
||||
export GIT_USER_MAIL="hi@caos.ch"
|
||||
export GIT_USER_NAME="zitadel-pipeline"
|
||||
|
||||
#path of opsrepository
|
||||
export GIT_URL="https://$GIT_OPSREPO_DEPLOYTOKEN@github.com/caos/zitadel-ops.git"
|
||||
export GIT_OPSREPO="citadel-ops"
|
||||
|
||||
### application settings
|
||||
export GIT_OPSREPO_APPFOLDER="k8s/workload"
|
||||
export GIT_OPSREPO_APPLICATION_NAME="zitadel"
|
||||
export GIT_OPSREPO_IMAGEFILE="imageversion.yaml"
|
||||
export REGISTRY_IMAGE="$REGISTRY/$GITHUB_REPOSITORY/$IMAGE"
|
||||
|
||||
### environment settings
|
||||
#export TARGET_ENVIRONMENT="dev"
|
||||
|
||||
|
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@ -213,3 +213,14 @@ jobs:
|
||||
- name: Docker Push Latest
|
||||
run: docker push $REGISTRY/$GITHUB_REPOSITORY/$IMAGE:latest
|
||||
if: env.CAOS_NEXT_VERSION != ''
|
||||
- name: Deploy DEV environment
|
||||
env:
|
||||
TARGET_ENVIRONMENT: "dev"
|
||||
GIT_OPSREPO_DEPLOYTOKEN: ${{secrets.GIT_OPSREPO_DEPLOYTOKEN}}
|
||||
run: |
|
||||
source ./.github/scripts/githelper.sh
|
||||
setup_git
|
||||
checkout_project
|
||||
change_image_version
|
||||
upload_files
|
||||
if: env.CAOS_NEXT_VERSION != ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user