@@ -3,15 +3,6 @@ name: Build and Create AppImage
33# Define a manual trigger with input for version
44on :
55 workflow_dispatch :
6- inputs :
7- version :
8- description : ' The version for the release'
9- required : true
10- default : ' vX.X.X'
11- release_notes :
12- description : ' Release notes or description for this version'
13- required : false
14- default : ' ## Release Note:'
156
167jobs :
178 build :
@@ -35,13 +26,42 @@ jobs:
3526 docker run --rm -v ${{ github.workspace }}:/workspace naderzare/ubuntu20-grpc-thrift:latest \
3627 bash -c "pwd && ls && cd /workspace/utils && ls && chmod +x build.sh && ./build.sh && cd /workspace/utils/app-image && chmod +x create_app_images.sh && ./create_app_images.sh"
3728
38- # Step 5: Upload the tar.gz file as a release asset
29+ # Step 4: Extract version and changes from ChangeLog
30+ - name : Extract version and changes from ChangeLog
31+ id : changelog
32+ run : |
33+ VERSION=$(grep -oP '## \[\K[^\]]+' ChangeLog.md | head -n 1)
34+ CHANGES=$(awk "/## \[$VERSION\]/ {flag=1; next} /^## \[/ {flag=0} flag" ChangeLog.md)
35+ echo "VERSION=$VERSION" >> $GITHUB_ENV
36+ echo "CHANGES<<EOF" >> $GITHUB_ENV
37+ echo "$CHANGES" >> $GITHUB_ENV
38+ echo "EOF" >> $GITHUB_ENV
39+
40+ # Step 5: Get the latest release version from GitHub
41+ - name : Get latest release version
42+ id : get_latest_release
43+ run : |
44+ LATEST_RELEASE_VERSION=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
45+ echo "LATEST_RELEASE_VERSION=$LATEST_RELEASE_VERSION" >> $GITHUB_ENV
46+
47+ # Step 6: Compare the extracted version with the latest release version
48+ - name : Compare versions
49+ run : |
50+ if [ "${{ env.VERSION }}" == "${{ env.LATEST_RELEASE_VERSION }}" ]; then
51+ echo "Error: Version ${{ env.VERSION }} is the same as the latest released version."
52+ exit 1
53+ fi
54+
55+ # Step 7: Upload the tar.gz file as a release asset
3956 - name : Create GitHub Release
4057 uses : softprops/action-gh-release@v1
4158 with :
4259 files : ${{ github.workspace }}/utils/app-image/soccer-simulation-proxy.tar.gz
43- tag_name : ${{ github.event.inputs.version }}
44- name : " Version ${{ github.event.inputs.version }}"
45- body : ${{ github.event.inputs.release_notes }}
60+ tag_name : ${{ env.VERSION }}
61+ release_name : Release ${{ env.VERSION }}
62+ name : Release ${{ env.VERSION }}
63+ body : ${{ env.CHANGES }}
64+ draft : false
65+ prerelease : false
4666 env :
4767 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments