diff --git a/.github/workflows/create-latest-release.yml b/.github/workflows/create-latest-release.yml new file mode 100644 index 000000000..efbe2432a --- /dev/null +++ b/.github/workflows/create-latest-release.yml @@ -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 "actions@github.com" + 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" \ No newline at end of file diff --git a/.github/workflows/create-scheduled-release.yml b/.github/workflows/create-scheduled-release.yml index 18927f662..46bc40b56 100644 --- a/.github/workflows/create-scheduled-release.yml +++ b/.github/workflows/create-scheduled-release.yml @@ -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) ./gradlew generateMatrixDiffCoordinates -PbaseCommit=$(git show-ref -s $LATEST_TAG) -PnewCommit=$(git rev-parse HEAD) release: @@ -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)