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
2
2
3
3
name : Create Release
4
4
5
5
# Controls when the action will run. Workflow runs when manually triggered using the UI
6
6
# or on push in charts directory of main branch.
7
7
on :
8
-
9
8
workflow_dispatch :
10
9
11
10
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12
11
jobs :
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
+
14
46
create-release :
15
- # The type of runner that the job will run on
47
+ needs : create-release-tag
16
48
runs-on : ubuntu-latest
17
49
18
50
# Steps represent a sequence of tasks that will be executed as part of the job
19
51
steps :
20
52
# Runs series of commands to create a release
21
53
- name : create-release
22
54
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}')
25
55
FILE_NAME=${FILE_NAME:=releasenotes.md}
26
56
echo $RELEASE_TYPE
27
57
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
28
65
gh repo clone $GITHUB_REPOSITORY
29
66
cd devtron
30
- if [[ "$RELEASE_TYPE" == "stable " ]]
67
+ if [[ "$RELEASE_TYPE" == "major" || "$RELEASE_TYPE" == "minor" || "$RELEASE_TYPE" == "patch " ]]
31
68
then
32
69
tag=$(git tag --sort=committerdate | tail -1)
33
70
echo $tag
39
76
git config --global user.name "$GIT_CONFIG_NAME"
40
77
rm -f $FILE_NAME
41
78
touch $FILE_NAME
42
- echo "## Bugs" > beta-releasenotes.md
43
79
echo "## Enhancements" >> beta-releasenotes.md
44
- echo "## Documentation" > > beta-releasenotes.md
80
+ echo "## Bugs" > beta-releasenotes.md
45
81
echo "## Others" >> beta-releasenotes.md
46
- echo "beta -1 $tag" > manifests/release.txt
47
82
git add .
48
83
git commit -am "Updated release-notes files"
49
84
git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot
@@ -52,26 +87,29 @@ jobs:
52
87
git checkout -b release-bot
53
88
git config --global user.email "$GIT_CONFIG_EMAIL"
54
89
git config --global user.name "$GIT_CONFIG_NAME"
55
- echo "## Bugs" > beta-releasenotes.md
56
90
echo "## Enhancements" >> beta-releasenotes.md
57
- echo "## Documentation" > > beta-releasenotes.md
91
+ echo "## Bugs" > beta-releasenotes.md
58
92
echo "## Others" >> beta-releasenotes.md
59
93
git add .
60
94
git commit -am "Created release-notes files"
61
95
git push -f https://${GIT_CONFIG_NAME}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} release-bot
62
96
echo "Not creating release due to beta"
63
97
fi
64
98
env :
99
+ RELEASE_BRANCH : " main"
65
100
GH_TOKEN : ${{ secrets.GH_SYSTEMSDT_TOKEN }}
66
- RELEASE_BRANCH : ${{ secrets.RELEASE_BRANCH }}
67
101
GIT_CONFIG_NAME : ${{ vars.GH_SYSTEMSDT_USERNAME }}
68
102
GIT_CONFIG_EMAIL : ${{ secrets.GH_SYSTEMSDT_EMAIL }}
69
103
# Send notification on discord
70
104
- name : discord-notify
71
105
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" ]]
75
113
then
76
114
sudo apt install python3 python3-pip -y
77
115
pip install discord-webhook
84
122
then
85
123
echo "Not sending notification due to beta"
86
124
fi
87
- env :
88
- RELEASE_BRANCH : ${{ secrets.RELEASE_BRANCH }}
0 commit comments