Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Latest Release for Every Merged Pull Request #543

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/create-latest-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "Create latest release"

on:
push:
branches:
- master

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: 'oracle'
java-version: '21'
- name: "🕸️ Get changed metadata matrix"
id: set-matrix
run: |
./gradlew generateMatrixDiffCoordinates -PbaseCommit=$(git show-ref -s "latest") -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: "⬆️ Update version"
run: |
sed -i "s/project.version(\"1.0.0-SNAPSHOT\")/project.version(\"latest\")/g" build.gradle
- name: "🔍 Run spotless check"
run: |
./gradlew spotlessCheck
- name: "🏭 Generate release artifacts"
run: |
./gradlew package
- name: "Delete previous latest release and tag"
run: |
gh release delete "latest" --cleanup-tag -y
- name: "📄 Commit changes"
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions"
git add .
git commit -m "Update latest release"
git tag "latest"
git push origin "latest"
- name: "📝 Publish a release"
run: |
gh release create "latest" build/graalvm-reachability-metadata-*.zip --title "Latest"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line

4 changes: 2 additions & 2 deletions .github/workflows/create-scheduled-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: "🕸️ Get changed metadata matrix"
id: set-matrix
run: |
LATEST_TAG=$(git tag --list | sort -V | tail -1)
LATEST_TAG=$(git tag --list | grep -v latest | sort -V | tail -1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This additional step skips latest tag as potential base for next standard release tag name (as we always bump patch version in the version string, we want to do so from the latest standard release).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe write that comment in the file?

./gradlew generateMatrixDiffCoordinates -PbaseCommit=$(git show-ref -s $LATEST_TAG) -PnewCommit=$(git rev-parse HEAD)

release:
Expand All @@ -52,7 +52,7 @@ jobs:
java-version: '21'
- name: "Get tags"
run: |
PREVIOUS_RELEASE_TAG=$(git tag --list | sort -V | tail -1)
PREVIOUS_RELEASE_TAG=$(git tag --list | grep -v latest | 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)
Expand Down
Loading