diff --git a/.github/workflows/github_release.yml b/.github/workflows/github_release.yml new file mode 100644 index 0000000..f066ddf --- /dev/null +++ b/.github/workflows/github_release.yml @@ -0,0 +1,26 @@ +name: Make draft release + +on: + workflow_dispatch: + +jobs: + jpackage: + name: Run JPackage + uses: ./.github/workflows/jpackage.yml + + release: + needs: jpackage + permissions: + contents: write + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + + - name: Release + env: + GH_TOKEN: ${{ github.token }} + run: gh release create --draft ${{ github.ref_name }} --title ${{ github.ref_name }} build/*.jar diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index 2a01281..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,42 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle - -name: Java CI with Gradle - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - workflow_dispatch: - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 # TODO: check Java version - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b - - name: Build with Gradle - uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 - with: - arguments: build - - uses: actions/upload-artifact@v3 - with: - name: jar - path: build/libs - retention-days: 7 diff --git a/.github/workflows/jpackage.yml b/.github/workflows/jpackage.yml new file mode 100644 index 0000000..ae389bc --- /dev/null +++ b/.github/workflows/jpackage.yml @@ -0,0 +1,40 @@ +name: Java CI with Gradle + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + workflow_call: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v4 + + - name: Set up JDK 17 # TODO: check Java version + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v2 + + - name: Build with Gradle + uses: gradle/gradle-build-action@v3 + with: + arguments: build + + - uses: actions/upload-artifact@v4 + with: + path: build/libs/*.jar + name: build + retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 8057f78..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Make draft release - -on: - push: - tags: ["v*"] - workflow_dispatch: - -jobs: - release: - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Define version env variable - run: | - echo "VERSION=$(echo ${{ github.ref_name }} | sed -r 's/v([0-9]+\.[0-9]+\.?[0-9]?)/\1/'" >> $GITHUB_ENV - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1.1.0 - - name: Build with Gradle - uses: gradle/gradle-build-action@v2.7.1 - with: - arguments: build -Pversion=$VERSION - - name: Release - env: - GH_TOKEN: ${{ github.token }} - run: gh release create --draft ${{ github.ref_name }} --title ${{ github.ref_name }} build/libs/* diff --git a/README.md b/README.md index 62061dd..9ccdf0b 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,34 @@ Add a license file to your GitHub repo so that others know what they can and can This should be compatible with QuPath's license -- see https://github.com/qupath/qupath +## Repository configuration + +### Easy install + +If you follow some conventions in naming your extension and making releases, then other QuPath users will find it easy to automatically +install and update your extension! + +First, we suggest you name your extension `qupath-extension-[something]`, and keep it in its own repository (named the same as the extension), +separate from other projects. + +Next, when you want to publish a new version of your extension, use the `github_release.yml` workflow included in this repository. + +To do so, you'd need to navigate to `Actions -> Make draft release -> Run workflow -> Run workflow` as shown in the following screenshot: + +![Screenshot from 2024-03-14 18-44-42](https://github.com/alanocallaghan/qupath-extension-template/assets/10779688/4712a209-eda7-4f80-8bed-bbab20e4f50a) + +This will automatically build the extension, and create a draft release containing the extension jar (and its associated sources and javadoc). +You can then navigate to `Releases` and fill out information about the release --- the version, any significant changes, etc. +Once published, users will be able to automatically install the extension as described here: +https://qupath.readthedocs.io/en/0.5/docs/intro/extensions.html#installing-extensions + +### Automatic updates + +To enable easy installation and automatic updates in QuPath, fill in the (**public**) GitHub owner and repository +for the extension. + +https://github.com/qupath/qupath-extension-template/blob/778f02759d8a7fe5c73f1751edd58b6494beff9f/src/main/java/qupath/ext/template/DemoExtension.java#L65-L66 + ### Replace this readme Don't forget to replace the contents of this readme with your own!