1- # This workflow is used to create a github release from last tag pushed
1+ # This workflow is used to create tag and Release for OSS
22
33name : Create Release
44
55# Controls when the action will run. Workflow runs when manually triggered using the UI
66# or on push in charts directory of main branch.
77on :
8-
98 workflow_dispatch :
109
1110# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1211jobs :
13- # This workflow contains a single job called "create-release"
12+
13+ create-release-tag :
14+ runs-on : ubuntu-latest
15+
16+ env :
17+ GITHUB_TOKENS : ${{ secrets.GH_SYSTEMSDT_TOKEN }}
18+ GIT_CONFIG_EMAIL : ${{ secrets.GH_SYSTEMSDT_EMAIL }}
19+ GIT_CONFIG_NAME : ${{ secrets.GH_SYSTEMSDT_USERNAME }}
20+ GIT_USERNAME : ${{ secrets.GH_SYSTEMSDT_USERNAME }}
21+ GIT_REPO : ${{ github.repository }}
22+ REPO : https://github.com/devtron-labs/devtron
23+ RELEASE_BRANCH : " main"
24+
25+ steps :
26+
27+ - name : Configure Git
28+ run : |
29+ echo $GITHUB_TOKENS > tokens.txt
30+ gh auth login --with-token < tokens.txt
31+ git config --global user.email "$GIT_CONFIG_EMAIL"
32+ git config --global user.name "$GIT_CONFIG_NAME"
33+
34+ - name : Clone repository and create tag
35+ run : |
36+ mkdir preci && cd preci
37+ gh repo clone "$REPO"
38+ cd $(basename "$REPO")
39+ git checkout $RELEASE_BRANCH
40+ git pull origin $RELEASE_BRANCH
41+ NEXT_RELEASE_VERSION=v$(curl -s https://raw.githubusercontent.com/devtron-labs/charts/refs/heads/main/charts/devtron/Chart.yaml | grep 'appVersion' | awk '{print $2}')
42+ # Create and push tag
43+ git tag $NEXT_RELEASE_VERSION
44+ git push -f https://$GIT_USERNAME:[email protected] /$GIT_REPO $NEXT_RELEASE_VERSION 45+
1446 create-release :
15- # The type of runner that the job will run on
47+ needs : create-release-tag
1648 runs-on : ubuntu-latest
1749
1850 # Steps represent a sequence of tasks that will be executed as part of the job
1951 steps :
2052 # Runs series of commands to create a release
2153 - name : create-release
2254 run : |
23- RELEASE_FILE_CONTENTS=$(curl -L -s "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${RELEASE_BRANCH}/manifests/release.txt" )
24- RELEASE_TYPE=$(echo $RELEASE_FILE_CONTENTS | awk '{print $1}')
2555 FILE_NAME=${FILE_NAME:=releasenotes.md}
2656 echo $RELEASE_TYPE
2757 echo $GITHUB_REPOSITORY
58+ echo $RELEASE_BRANCH
59+ version=$(curl -s https://raw.githubusercontent.com/devtron-labs/devtron/refs/heads/main/charts/devtron/Chart.yaml | grep "appVersion" | awk -F ': ' '{print $2}' )
60+ if [[ "$version" == *"-rc"* ]]; then
61+ RELEASE_TYPE="beta"
62+ else
63+ RELEASE_TYPE="minor"
64+ fi
2865 gh repo clone $GITHUB_REPOSITORY
2966 cd devtron
30- if [[ "$RELEASE_TYPE" == "stable " ]]
67+ if [[ "$RELEASE_TYPE" == "major" || "$RELEASE_TYPE" == "minor" || "$RELEASE_TYPE" == "patch " ]]
3168 then
3269 tag=$(git tag --sort=committerdate | tail -1)
3370 echo $tag
3976 git config --global user.name "$GIT_CONFIG_NAME"
4077 rm -f $FILE_NAME
4178 touch $FILE_NAME
42- echo "## Bugs" > beta-releasenotes.md
4379 echo "## Enhancements" >> beta-releasenotes.md
44- echo "## Documentation" > > beta-releasenotes.md
80+ echo "## Bugs" > beta-releasenotes.md
4581 echo "## Others" >> beta-releasenotes.md
46- echo "beta -1 $tag" > manifests/release.txt
4782 git add .
4883 git commit -am "Updated release-notes files"
4984 git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot
@@ -52,26 +87,29 @@ jobs:
5287 git checkout -b release-bot
5388 git config --global user.email "$GIT_CONFIG_EMAIL"
5489 git config --global user.name "$GIT_CONFIG_NAME"
55- echo "## Bugs" > beta-releasenotes.md
5690 echo "## Enhancements" >> beta-releasenotes.md
57- echo "## Documentation" > > beta-releasenotes.md
91+ echo "## Bugs" > beta-releasenotes.md
5892 echo "## Others" >> beta-releasenotes.md
5993 git add .
6094 git commit -am "Created release-notes files"
6195 git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot
6296 echo "Not creating release due to beta"
6397 fi
6498 env :
99+ RELEASE_BRANCH : " main"
65100 GH_TOKEN : ${{ secrets.GH_SYSTEMSDT_TOKEN }}
66- RELEASE_BRANCH : ${{ secrets.RELEASE_BRANCH }}
67101 GIT_CONFIG_NAME : ${{ vars.GH_SYSTEMSDT_USERNAME }}
68102 GIT_CONFIG_EMAIL : ${{ secrets.GH_SYSTEMSDT_EMAIL }}
69103 # Send notification on discord
70104 - name : discord-notify
71105 run : |
72- RELEASE_FILE_CONTENTS=$(curl -L -s "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${RELEASE_BRANCH}/manifests/release.txt" )
73- RELEASE_TYPE=$(echo $RELEASE_FILE_CONTENTS | awk '{print $1}')
74- if [[ "$RELEASE_TYPE" == "stable" ]]
106+ version=$(curl -s https://raw.githubusercontent.com/devtron-labs/devtron/refs/heads/main/charts/devtron/Chart.yaml | grep "appVersion" | awk -F ': ' '{print $2}' )
107+ if [[ "$version" == *"-rc"* ]]; then
108+ RELEASE_TYPE="beta"
109+ else
110+ RELEASE_TYPE="minor"
111+ fi
112+ if [[ "$RELEASE_TYPE" == "major" || "$RELEASE_TYPE" == "minor" || "$RELEASE_TYPE" == "patch" ]]
75113 then
76114 sudo apt install python3 python3-pip -y
77115 pip install discord-webhook
84122 then
85123 echo "Not sending notification due to beta"
86124 fi
87- env :
88- RELEASE_BRANCH : ${{ secrets.RELEASE_BRANCH }}
0 commit comments