1+ # .github/workflows/release-on-dsl-version-change.yml
2+
3+ name : Release on DSL Version Change
4+
5+ on :
6+ push :
7+ branches :
8+ - main
9+
10+ jobs :
11+ check-dsl-version :
12+ runs-on : ubuntu-latest
13+ outputs :
14+ dsl_version_changed : ${{ steps.check_dsl.outputs.dsl_version_changed }}
15+ current : ${{ steps.get_version.outputs.current }}
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0 # Fetch all tags
21+
22+ - name : Clean up stale submodule config
23+ run : git config --file .git/config --remove-section submodule.build/common-domain-model || true
24+
25+ - name : Set up JDK
26+ uses : actions/setup-java@v4
27+ with :
28+ distribution : ' temurin'
29+ java-version : ' 21'
30+ cache : maven
31+
32+ - name : Get current DSL version from POM
33+ id : get_version
34+ run : |
35+ CURRENT=$(mvn help:evaluate -Dexpression=rosetta.dsl.version -q -DforceStdout)
36+ echo "Current DSL version: $CURRENT"
37+ echo "current=$CURRENT" >> $GITHUB_OUTPUT
38+
39+ - name : Get latest rosetta-dsl-v* tag
40+ id : get_tag
41+ run : |
42+ TAG=$(git tag --list 'rosetta-dsl-v*' --sort=-v:refname | head -n 1)
43+ if [ -z "$TAG" ]; then
44+ TAG_VERSION=""
45+ else
46+ TAG_VERSION="${TAG#rosetta-dsl-v}"
47+ fi
48+ echo "Latest tag: $TAG"
49+ echo "Latest tag version: $TAG_VERSION"
50+ echo "tag=$TAG" >> $GITHUB_OUTPUT
51+ echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
52+
53+ - name : Check if DSL version is different from latest tag
54+ id : check_dsl
55+ run : |
56+ CURRENT="${{ steps.get_version.outputs.current }}"
57+ TAG_VERSION="${{ steps.get_tag.outputs.tag_version }}"
58+ if [ -z "$TAG_VERSION" ]; then
59+ echo "No previous tag found. Proceeding with release."
60+ echo "dsl_version_changed=true" >> $GITHUB_OUTPUT
61+ elif [ "$CURRENT" != "$TAG_VERSION" ]; then
62+ echo "DSL version ($CURRENT) is different from latest tag ($TAG_VERSION). Proceeding with release."
63+ echo "dsl_version_changed=true" >> $GITHUB_OUTPUT
64+ else
65+ echo "DSL version ($CURRENT) matches latest tag ($TAG_VERSION). Skipping release."
66+ echo "dsl_version_changed=false" >> $GITHUB_OUTPUT
67+ fi
68+
69+ release :
70+ needs : check-dsl-version
71+ if : needs.check-dsl-version.outputs.dsl_version_changed == 'true'
72+ uses : ./.github/workflows/release-core.yml
73+ with :
74+ release_version : ${{ needs.check-dsl-version.outputs.current }}
0 commit comments