diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f19a835 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: Java CI + +on: + push: + branches: + - "**" + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + cache: maven + + - name: Build and test with Maven + run: mvn -B clean package + + - name: Resolve project metadata + id: meta + run: | + VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version) + ARTIFACT_ID=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.artifactId) + SHORT_SHA=${GITHUB_SHA::7} + VERSIONED_NAME="${ARTIFACT_ID}-${VERSION}-${GITHUB_RUN_NUMBER}-${SHORT_SHA}.jar" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "artifact_id=${ARTIFACT_ID}" >> "$GITHUB_OUTPUT" + echo "versioned_name=${VERSIONED_NAME}" >> "$GITHUB_OUTPUT" + + - name: Prepare versioned JAR + run: | + mkdir -p dist + cp "target/${{ steps.meta.outputs.artifact_id }}-${{ steps.meta.outputs.version }}.jar" "dist/${{ steps.meta.outputs.versioned_name }}" + + - name: Upload versioned JAR artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.meta.outputs.versioned_name }} + path: dist/${{ steps.meta.outputs.versioned_name }} + if-no-files-found: error diff --git a/.github/workflows/dev-prerelease.yml b/.github/workflows/dev-prerelease.yml new file mode 100644 index 0000000..018e5d9 --- /dev/null +++ b/.github/workflows/dev-prerelease.yml @@ -0,0 +1,63 @@ +name: Dev Branch Prerelease + +on: + push: + branches: + - dev + - dev/** + +permissions: + contents: write + +jobs: + prerelease: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + cache: maven + + - name: Build and test with Maven + run: mvn -B clean package + + - name: Resolve artifact metadata + id: meta + run: | + VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version) + ARTIFACT_ID=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.artifactId) + BRANCH_NAME="${GITHUB_REF_NAME//\//-}" + SHORT_SHA=${GITHUB_SHA::7} + TAG_NAME="dev-${BRANCH_NAME}-${GITHUB_RUN_NUMBER}-${SHORT_SHA}" + JAR_NAME="${ARTIFACT_ID}-${VERSION}-${BRANCH_NAME}-${GITHUB_RUN_NUMBER}-${SHORT_SHA}.jar" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "artifact_id=${ARTIFACT_ID}" >> "$GITHUB_OUTPUT" + echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT" + echo "jar_name=${JAR_NAME}" >> "$GITHUB_OUTPUT" + + - name: Prepare versioned JAR + run: | + mkdir -p dist + cp "target/${{ steps.meta.outputs.artifact_id }}-${{ steps.meta.outputs.version }}.jar" "dist/${{ steps.meta.outputs.jar_name }}" + + - name: Upload prerelease artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.meta.outputs.jar_name }} + path: dist/${{ steps.meta.outputs.jar_name }} + if-no-files-found: error + + - name: Publish GitHub prerelease + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.meta.outputs.tag_name }} + name: Dev Prerelease ${{ steps.meta.outputs.tag_name }} + prerelease: true + generate_release_notes: true + files: dist/${{ steps.meta.outputs.jar_name }} diff --git a/.github/workflows/main-release.yml b/.github/workflows/main-release.yml new file mode 100644 index 0000000..785b2c5 --- /dev/null +++ b/.github/workflows/main-release.yml @@ -0,0 +1,61 @@ +name: Main Branch Release + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + cache: maven + + - name: Build and test with Maven + run: mvn -B clean package + + - name: Resolve artifact metadata + id: meta + run: | + VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version) + ARTIFACT_ID=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.artifactId) + SHORT_SHA=${GITHUB_SHA::7} + TAG_NAME="v${VERSION}-${GITHUB_RUN_NUMBER}-${SHORT_SHA}" + JAR_NAME="${ARTIFACT_ID}-${VERSION}-${GITHUB_RUN_NUMBER}-${SHORT_SHA}.jar" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "artifact_id=${ARTIFACT_ID}" >> "$GITHUB_OUTPUT" + echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT" + echo "jar_name=${JAR_NAME}" >> "$GITHUB_OUTPUT" + + - name: Prepare versioned JAR + run: | + mkdir -p dist + cp "target/${{ steps.meta.outputs.artifact_id }}-${{ steps.meta.outputs.version }}.jar" "dist/${{ steps.meta.outputs.jar_name }}" + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.meta.outputs.jar_name }} + path: dist/${{ steps.meta.outputs.jar_name }} + if-no-files-found: error + + - name: Publish GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.meta.outputs.tag_name }} + name: Release ${{ steps.meta.outputs.tag_name }} + prerelease: false + generate_release_notes: true + files: dist/${{ steps.meta.outputs.jar_name }} diff --git a/.gitignore b/.gitignore index 8a84d6f..4129a7f 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,6 @@ TEST_SUMMARY.md *.so *.dll *.dylib + +# Local assistant context file +CLAUDE.md