-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Action for Scheduled Releases (#537)
* Add github action that creates automatic scheduled releases * Test and generate artifacts before committing changes * Use tag --list to get list of tags * Change a palceholder for repo version in build.gradle * Add comment about fixed snapshot version * Update .github/workflows/create-scheduled-release.yml --------- Co-authored-by: Fabio Niephaus <[email protected]>
- Loading branch information
Showing
3 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: "Create scheduled release" | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
- cron: "0 0 15 * *" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
get-changed-metadata: | ||
name: "📋 Get a list of changed metadata" | ||
runs-on: "ubuntu-20.04" | ||
timeout-minutes: 5 | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
none-found: ${{ steps.set-matrix.outputs.none-found }} | ||
steps: | ||
- name: "☁️ Checkout repository" | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: "🔧 Setup java" | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'graalvm' | ||
java-version: '21' | ||
- name: "🕸️ Get changed metadata matrix" | ||
id: set-matrix | ||
run: | | ||
LATEST_TAG=$(git tag --list | sort -V | tail -1) | ||
./gradlew generateMatrixDiffCoordinates -PbaseCommit=$(git show-ref -s $LATEST_TAG) -PnewCommit=$(git rev-parse HEAD) | ||
release: | ||
needs: get-changed-metadata | ||
if: needs.get-changed-metadata.result == 'success' && needs.get-changed-metadata.outputs.none-found != 'true' | ||
name: "🚀 Create a release" | ||
runs-on: "ubuntu-20.04" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
steps: | ||
- name: "☁️ Checkout repository" | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: "🔧 Setup java" | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'graalvm' | ||
java-version: '21' | ||
- name: "Get tags" | ||
run: | | ||
PREVIOUS_RELEASE_TAG=$(git tag --list | sort -V | tail -1) | ||
echo "PREVIOUS_RELEASE_TAG=$PREVIOUS_RELEASE_TAG" >> ${GITHUB_ENV} | ||
CURRENT_RELEASE_TAG=$(sed -E 's/^([0-9]+\.)([0-9]+\.)([0-9]+)/echo \1\2$((\3+1))/e' <<< $PREVIOUS_RELEASE_TAG) | ||
echo "CURRENT_RELEASE_TAG=$CURRENT_RELEASE_TAG" >> ${GITHUB_ENV} | ||
- name: "⬆️ Update version" | ||
run: | | ||
sed -i "s/project.version(\"1.0.0-SNAPSHOT\")/project.version(\"${{ env.CURRENT_RELEASE_TAG }}\")/g" build.gradle | ||
- name: "🔍 Run spotless check" | ||
run: | | ||
./gradlew spotlessCheck | ||
- name: "🏭 Generate release artifacts" | ||
run: | | ||
./gradlew package | ||
- name: "📄 Commit changes" | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Github Actions" | ||
git add . | ||
git commit -m "Release version ${{ env.CURRENT_RELEASE_TAG }}" | ||
git tag ${{ env.CURRENT_RELEASE_TAG }} | ||
git push origin ${{ env.CURRENT_RELEASE_TAG }} | ||
- name: "📝 Publish a release" | ||
run: | | ||
gh release create ${{ env.CURRENT_RELEASE_TAG }} build/graalvm-reachability-metadata-*.zip --generate-notes --notes-start-tag ${{ env.PREVIOUS_RELEASE_TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |