Skip to content
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
160 changes: 160 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Build AppleSingle 'asu' CLI and API

on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: read

jobs:
build-java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up JDK 25
uses: actions/setup-java@v6.0.1
with:
java-version: '25'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Build with Gradle
run: ./gradlew build
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: build-artifacts
path: |
tools/asu/build/libs/applesingle-tools-asu-*.jar
!tools/asu/build/libs/applesingle-tools-asu-*-plain.jar
archive: false
if-no-files-found: error

# This is a crude license header check. The ones I tested were susceptible to whitespace differences
# and I never got them to work. My primary goal is to ensure the headers exist, so this suffices.
license-check:
name: License check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Look for license phrase
run: |
outfile=$(mktemp)
find . -name "*.java" -not -name module-info.java | xargs grep -L "GNU General Public License" > ${outfile}
if [ -s "${outfile}" ]
then
echo "License headers missing on the following files:"
cat ${outfile}
exit 1
else
echo "License headers appear to be valid!"
fi

build-native:
name: asu on ${{ matrix.os }}-${{ matrix.arch }}
needs: [build-java, license-check]
runs-on: ${{ matrix.label }}
strategy:
matrix:
# See: https://docs.github.com/en/actions/concepts/runners/about-github-hosted-runners#overview-of-github-hosted-runners
# ... and follow the links to the related Github repositories
include:
- label: ubuntu-latest
os: linux
arch: x86_64
- label: ubuntu-24.04-arm
os: linux
arch: aarch64
- label: windows-latest
os: windows
arch: x86_64
- label: macos-15-intel
os: darwin
arch: x86_64
- label: macos-15
os: darwin
arch: arm64
steps:
- uses: actions/checkout@v7
- uses: graalvm/setup-graalvm@v1
with:
java-version: '25'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Build 'asu'
run: ./gradlew nativeCompile
env:
# Needed for Windows; not an issue for other OSes
GRADLE_OPTS: -Djava.io.tmpdir=${{ runner.temp }}
- name: Run UPX
uses: crazy-max/ghaction-upx@v4
if: runner.os == 'Linux'
with:
files: |
tools/asu/build/native/nativeCompile/asu*
- name: Upload binary
uses: actions/upload-artifact@v7
with:
name: asu-${{ matrix.os }}-${{ matrix.arch }}
path: tools/asu/build/native/nativeCompile/asu*

release:
name: Create draft release
if: github.ref_type == 'tag'
needs: [build-java, build-native]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
merge-multiple: true
- uses: softprops/action-gh-release@v3
with:
draft: true
generate_release_notes: true
files: |
asu-*
applesingle-tools-asu-*.jar

publish:
name: Publish to Maven Central
if: github.ref_type == 'tag'
needs: [build-java, build-native]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up JDK 25
uses: actions/setup-java@v6.0.1
with:
java-version: '25'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Publish with Gradle
run: |
export ORG_GRADLE_PROJECT_signingKey=$(echo "$GPG_SIGNING_KEY_BASE64" | base64 -d)
./gradlew build publish -x test
env:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
GPG_SIGNING_KEY_BASE64: ${{ secrets.GPG_SIGNING_KEY_BASE64 }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
- name: Setup .netrc file
uses: extractions/netrc@v3
with:
machine: ossrh-staging-api.central.sonatype.com
username: ${{ secrets.OSSRH_USERNAME }}
password: ${{ secrets.OSSRH_TOKEN }}
- name: Finish publishing
run: ./scripts/finish-publishing.sh
40 changes: 0 additions & 40 deletions .github/workflows/gradle.yml

This file was deleted.

58 changes: 0 additions & 58 deletions .github/workflows/nativeCompile.yml

This file was deleted.

17 changes: 17 additions & 0 deletions HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* AppleSingle - A Java library and command-line tool for AppleSingle support.
* Copyright (C) 2026 Robert Greene
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
18 changes: 12 additions & 6 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,21 @@ artifacts {
publishing {
publications {
mavenJava(MavenPublication) {
groupId = "org.applecommander"
artifactId = "applesingle-api"

from components.java

artifact sourcesJar
artifact javadocJar
pom {
groupId = "net.sf.applecommander"
artifactId = "applesingle-api"
name = 'applesingle-api'
description = 'A Java library for managing AppleSingle files.'
url = 'https://applecommander.github.io/'
licenses {
license {
name = 'The GNU General Public License (GPL) Version 2, June 1991'
url = 'https://www.gnu.org/licenses/gpl-2.0.html'
name = 'The GNU General Public License (GPL) Version 3, June 2007'
url = 'https://www.gnu.org/licenses/gpl-3.0.html'
}
}
developers {
Expand All @@ -74,8 +76,8 @@ publishing {
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots/"
url = isSnapshotVersion ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = findProperty('ossrhUsername')
Expand All @@ -88,5 +90,9 @@ publishing {
}

signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
def signingKeyId = findProperty("signingKeyId")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications.mavenJava
}
3 changes: 3 additions & 0 deletions api/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module org.applecommander.applesingle {
exports org.applecommander.applesingle;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
package io.github.applecommander.applesingle;
/*
* AppleSingle - A Java library and command-line tool for AppleSingle support.
* Copyright (C) 2026 Robert Greene
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.applecommander.applesingle;

import java.io.File;
import java.io.FileOutputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
package io.github.applecommander.applesingle;
/*
* AppleSingle - A Java library and command-line tool for AppleSingle support.
* Copyright (C) 2026 Robert Greene
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.applecommander.applesingle;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
package io.github.applecommander.applesingle;
/*
* AppleSingle - A Java library and command-line tool for AppleSingle support.
* Copyright (C) 2026 Robert Greene
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.applecommander.applesingle;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Loading
Loading