Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Commit e6dc091

Browse files
authored
Merge pull request #634 from crowdbotics/PLAT-11893
PLAT-11893-Add release configuration
2 parents 8e37f4f + 9680e12 commit e6dc091

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/app-release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
8+
build:
9+
runs-on: ubuntu-latest
10+
env:
11+
working-directory: ./django-scaffold
12+
13+
steps:
14+
- name: Initialize packages
15+
run: |
16+
sudo apt update
17+
sudo apt install jo git -y
18+
19+
- name: Repo Clone
20+
run: |
21+
git clone https://${{ secrets.GIT_TOKEN }}@github.com/crowdbotics/django-scaffold.git
22+
23+
- name: Checkout branch
24+
working-directory: ${{ env.working-directory }}
25+
run: |
26+
echo "branch: ${GITHUB_REF_NAME}"
27+
git checkout ${GITHUB_REF_NAME}
28+
29+
- name: Generate Json data
30+
id: data
31+
working-directory: ${{ env.working-directory }}
32+
run: |
33+
r_version="$(curl -s -H "Authorization:token ${{ secrets.GIT_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/tags |jq -r '.[].name' |sort |head -1))"
34+
minor=$(echo $r_version | cut -d'.' -f2)
35+
major=$(echo $r_version | cut -d'.' -f1)
36+
if [ $major == $(date '+%Y%m%d') ]; then
37+
tag_version="$(date '+%Y%m%d').$minor"
38+
echo "release version: $tag_version"
39+
until [ $tag_version != $r_version ]; do
40+
let minor++
41+
tag_version="$(date '+%Y%m%d').$minor"
42+
echo "final release tag: $tag_version"
43+
done
44+
else
45+
tag_version=$(date '+%Y%m%d').1
46+
echo "final release tag: $tag_version"
47+
fi
48+
jo -p -- -s tag_name="$tag_version" name="Production Release" body="$(git log --oneline --no-decorate HEAD...$(git tag -l '202[0-9]????.*' --sort=-v:refname | head -n 1))" > data.json
49+
continue-on-error: true
50+
51+
- name: Json Data Status
52+
if: steps.data.outcome == 'failure'
53+
run: exit 1
54+
55+
- name: Add Release Notes
56+
working-directory: ${{ env.working-directory }}
57+
run: |
58+
cat data.json
59+
curl -i -X POST -H "Content-Type:application/json" -H "Authorization:token ${{ secrets.GIT_TOKEN }} " https://api.github.com/repos/$GITHUB_REPOSITORY/releases -d @data.json
60+
61+
- name: Add JIRA Label
62+
working-directory: ${{ env.working-directory }}
63+
run: |
64+
git log --oneline --no-decorate HEAD...$(git tag -l '202[0-9]????.*' --sort=-v:refname | head -n 1) | grep -Eo '([A-Z]{3,}-)([0-9]+)' | uniq > jira_ticket.txt
65+
cat jira_ticket.txt
66+
for i in $(cat jira_ticket.txt); do curl -s -X PUT -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.JIRA_TOKEN }}" --data '{"update":{"labels":[{"add":"released"}]}}' https://crowdbotics.atlassian.net/rest/api/3/issue/$i ; done

0 commit comments

Comments
 (0)