1+ name : " Create scheduled release"
2+
3+ on :
4+ schedule :
5+ - cron : " 0 0 1 * *"
6+ - cron : " 0 0 15 * *"
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : write
11+
12+ jobs :
13+ get-changed-metadata :
14+ name : " 📋 Get a list of changed metadata"
15+ runs-on : " ubuntu-20.04"
16+ timeout-minutes : 5
17+ outputs :
18+ matrix : ${{ steps.set-matrix.outputs.matrix }}
19+ none-found : ${{ steps.set-matrix.outputs.none-found }}
20+ steps :
21+ - name : " ☁️ Checkout repository"
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0
25+ - name : " 🔧 Setup java"
26+ uses : actions/setup-java@v4
27+ with :
28+ distribution : ' graalvm'
29+ java-version : ' 21'
30+ - name : " 🕸️ Get changed metadata matrix"
31+ id : set-matrix
32+ run : |
33+ LATEST_TAG=$(git tag --list | sort -V | tail -1)
34+ ./gradlew generateMatrixDiffCoordinates -PbaseCommit=$(git show-ref -s $LATEST_TAG) -PnewCommit=$(git rev-parse HEAD)
35+
36+ release :
37+ needs : get-changed-metadata
38+ if : needs.get-changed-metadata.result == 'success' && needs.get-changed-metadata.outputs.none-found != 'true'
39+ name : " 🚀 Create a release"
40+ runs-on : " ubuntu-20.04"
41+ env :
42+ GH_TOKEN : ${{ github.token }}
43+ steps :
44+ - name : " ☁️ Checkout repository"
45+ uses : actions/checkout@v4
46+ with :
47+ fetch-depth : 0
48+ - name : " 🔧 Setup java"
49+ uses : actions/setup-java@v4
50+ with :
51+ distribution : ' graalvm'
52+ java-version : ' 21'
53+ - name : " Get tags"
54+ run : |
55+ PREVIOUS_RELEASE_TAG=$(git tag --list | sort -V | tail -1)
56+ echo "PREVIOUS_RELEASE_TAG=$PREVIOUS_RELEASE_TAG" >> ${GITHUB_ENV}
57+
58+ CURRENT_RELEASE_TAG=$(sed -E 's/^([0-9]+\.)([0-9]+\.)([0-9]+)/echo \1\2$((\3+1))/e' <<< $PREVIOUS_RELEASE_TAG)
59+ echo "CURRENT_RELEASE_TAG=$CURRENT_RELEASE_TAG" >> ${GITHUB_ENV}
60+ - name : " ⬆️ Update version"
61+ run : |
62+ sed -i "s/project.version(\"1.0.0-SNAPSHOT\")/project.version(\"${{ env.CURRENT_RELEASE_TAG }}\")/g" build.gradle
63+ - name : " 🔍 Run spotless check"
64+ run : |
65+ ./gradlew spotlessCheck
66+ - name : " 🏭 Generate release artifacts"
67+ run : |
68+ ./gradlew package
69+ - name : " 📄 Commit changes"
70+ run : |
71+ git config --local user.email "[email protected] " 72+ git config --local user.name "Github Actions"
73+ git add .
74+ git commit -m "Release version ${{ env.CURRENT_RELEASE_TAG }}"
75+ git tag ${{ env.CURRENT_RELEASE_TAG }}
76+ git push origin ${{ env.CURRENT_RELEASE_TAG }}
77+ - name : " 📝 Publish a release"
78+ run : |
79+ gh release create ${{ env.CURRENT_RELEASE_TAG }} build/graalvm-reachability-metadata-*.zip --generate-notes --notes-start-tag ${{ env.PREVIOUS_RELEASE_TAG }}
0 commit comments