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

Publish Gradle plugin to Gradle Gallery #536

Merged
merged 2 commits into from
Jul 15, 2021
Merged
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
53 changes: 53 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "Publish to Gradle Gallery"
yahavi marked this conversation as resolved.
Show resolved Hide resolved
# During the build-info release, the build-info JARs upload to the Maven Central repository.
# The upload is asynchronous and may take few hours.
# Since the Gradle plugin depends on the build-info JARs, we should publish it to the Gradle Gallery only after we make
# sure the upload to Maven Central completed successfully.
# To solve this out, this workflow runs every 4 hours to check if the Gradle plugin should be published to the Gradle
Copy link
Contributor

Choose a reason for hiding this comment

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

To solve this out, this... --> To solve this issue, this...

# Gallery and publish the Gradle plugin if needed.
on:
schedule:
# Once per 4 hours
- cron: "0 */4 * * *"
jobs:
Publish_if_needed:
runs-on: ubuntu-latest
steps:
- name: "Get Maven Central Latest Version"
run: |
export LATEST_MVN_CENTRAL_VERSION=`curl -s https://search.maven.org/solrsearch/select\?q\=g:"org.jfrog.buildinfo"+AND+a:"build-info-extractor-gradle" | jq -r '.response.docs[0].latestVersio'`
Copy link

@NiazBikbaev NiazBikbaev Jul 15, 2021

Choose a reason for hiding this comment

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

@yahavi there is a typo in curl command :)
jq -r '.response.docs[0].latestVersio

Thats why scheduled job failed https://github.com/jfrog/build-info/runs/3080541646?check_suite_focus=true

echo "LATEST_MVN_CENTRAL_VERSION=$LATEST_MVN_CENTRAL_VERSION" >> $GITHUB_ENV
- name: "Convert Version to Regex"
uses: actions-ecosystem/action-regex-match@v2
id: check-version
with:
text: ${{ env.LATEST_MVN_CENTRAL_VERSION }}
regex: "[0-9]+.[0-9]+.[0-9]"
- name: "Test Resolved Version"
run: |
echo "Illegal version: $LATEST_MVN_CENTRAL_VERSION"
exit 1
if: ${{ steps.check-version.outputs.match == '' }}
- name: "Check Version in Gradle Gallery"
run: |
if curl -fL https://plugins.gradle.org/m2/org.jfrog.buildinfo/build-info-extractor-gradle/${{ steps.check-version.outputs.match }}; then
echo "SHOULD_NOT_PUBLISH=TRUE" >> $GITHUB_ENV
fi
- name: "Log if Already Exist"
run: echo "::warning::Version $LATEST_MVN_CENTRAL_VERSION already exist in the Gradle Gallery."
if: ${{ env.SHOULD_NOT_PUBLISH == 'TRUE'}}
- uses: actions/checkout@v2
with:
ref: refs/tags/build-info-gradle-extractor-${{ env.LATEST_MVN_CENTRAL_VERSION }}
if: ${{ env.SHOULD_NOT_PUBLISH != 'TRUE'}}
- uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "8"
if: ${{ env.SHOULD_NOT_PUBLISH != 'TRUE'}}
- name: "Publish to Gradle Gallery"
run: ./gradlew clean build -x test publishPlugins
if: ${{ env.SHOULD_NOT_PUBLISH != 'TRUE'}}
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build status](https://ci.appveyor.com/api/projects/status/omscno1vb7g11qu2?svg=true)](https://ci.appveyor.com/project/jfrog-ecosystem/build-info)
[![Build status](https://ci.appveyor.com/api/projects/status/omscno1vb7g11qu2?svg=true)](https://ci.appveyor.com/project/jfrog-ecosystem/build-info) [![Gradle plugin](https://img.shields.io/gradle-plugin-portal/v/com.jfrog.artifactory?label=Gradle%20Artifactory%20plugin)](https://plugins.gradle.org/plugin/com.jfrog.artifactory)

## Overview

Expand Down