Skip to content

Commit

Permalink
Merge pull request #2 from petebankhead/actions
Browse files Browse the repository at this point in the history
Add actions
  • Loading branch information
petebankhead authored Nov 29, 2024
2 parents d0e9314 + 75a845d commit 334f237
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run gradle build

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 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build with Gradle
run: |
./gradlew build
- uses: actions/upload-artifact@v4
with:
path: build/libs/*.jar
name: build
retention-days: 7
23 changes: 23 additions & 0 deletions .github/workflows/github_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Make draft release

on:
workflow_dispatch:

jobs:
build:
name: Run build
uses: ./.github/workflows/build.yml

release:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:

- 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
44 changes: 44 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish to SciJava Maven

on:
workflow_call:
inputs:
release:
required: false
type: boolean
default: false

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Add release flag if input variable is set
if: ${{ inputs.release }}
shell: bash
run: |
echo "RELEASE_FLAG='-Prelease'" >> $GITHUB_ENV
- name: Publish
shell: bash
run: |
./gradlew publish -P toolchain=21 $RELEASE_FLAG
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}

- uses: actions/upload-artifact@v3
if: ${{ inputs.release }}
with:
name: ${{ github.event.repository.name }}-release-jar
path: build/libs
retention-days: 7
12 changes: 12 additions & 0 deletions .github/workflows/maven_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Publish release to SciJava Maven

on:
workflow_dispatch:

jobs:
build:
name: Publish release
uses: ./.github/workflows/maven.yml
secrets: inherit
with:
release: true
10 changes: 10 additions & 0 deletions .github/workflows/maven_snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Publish snapshot to SciJava Maven

on:
workflow_dispatch:

jobs:
build:
name: Publish snapshot
uses: ./.github/workflows/maven.yml
secrets: inherit

0 comments on commit 334f237

Please sign in to comment.