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
55 changes: 55 additions & 0 deletions .github/workflows/ci-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI & Publish

on:
push:
branches: [ master ]
tags: [ 'v*' ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 25 (Azul Zulu)
if: "!startsWith(github.ref, 'refs/tags/v')"
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '25'
cache: maven

- name: Set up JDK 25 (Azul Zulu) for Maven Central
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '25'
cache: maven
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE

- name: Set release version from tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "Publishing version: $VERSION"
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false

- name: Build and test
run: mvn verify

- name: Publish to Maven Central
if: startsWith(github.ref, 'refs/tags/v')
run: mvn deploy -Prelease -DskipTests
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
103 changes: 103 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,106 @@ Select models through path sampling/stepping stone analysis
[Path sampling](http://www.beast2.org/path-sampling/)

[Path sampling with a GUI](http://www.beast2.org/2014/07/14/path-sampling-with-a-gui.html)

## For developer

Build the package, skipping tests:

```bash
mvn clean package -DskipTests
```

Run an example XML through BEAST:

```bash
mvn exec:exec -Dbeast.args="src/test/resources/modelselection/examples/normalTest-1.xml"
```
### Project folder structure

BEAUti templates and the example XMLs live under `src/`, not root directory:

```
src/
├── main/resources/modelselection/
│ ├── app/tools/ps.png
│ └── fxtemplates/
│ └── ModelSelection.xml
└── test/resources/modelselection/examples/
├── normalTest-1.xml, normalTest-2.xml, normalTestPS-1.xml, normalTestPS-2.xml,
│ testPairedPathSampler.xml, testPathSampler.xml, testPathSamplerForSimpleTree.xml
└── legacy/ (superseded example XMLs, excluded from the release ZIP)
```

`fxtemplates/` is a **main** resource, so it's bundled into the jar (see below).
`examples/` is a **test** resource, so the assembly plugin copies it into the ZIP's
top-level `/examples/` directly from `src/test/resources/`, excluding `legacy/**`
(see `src/assembly/beast-package.xml`).


## Releasing

### Jar folder structure

The release module jar, bundled into the BEAST package ZIP's `lib/`, contains:

```
META-INF/
├── MANIFEST.MF
└── maven/io.github.beast2-dev/model-selection/
├── pom.xml
└── pom.properties
modelselection/
├── app/tools/ (PathSampler, PathSampleAnalyser, PairedPathSampler*, GeneralisedSteppingStone, ps.png)
├── core/ (CPOLogger)
├── cpo/ (CPOAnalyser, BEASTRunAnalyser + inner classes)
├── fxtemplates/
│ └── ModelSelection.xml
├── gss/ (GeneralisedSteppingStone*, MCMC2GSS, MCMC2IS, GSSFromFile, TraceLog, ...)
│ ├── coalescent/
│ └── distribution/
└── inference/ (PathSampler, PathSamplingStep, PairedPathSampler*, AICMAnalyser, DiffLogger, ...)
version.xml
module-info.class
```

`modelselection/fxtemplates/ModelSelection.xml` is loaded via module path resource
lookup at runtime — `src/assembly/beast-package.xml` does not copy it anywhere else in
the ZIP.

### 1. Maven Central release (JARs)

Push a `v*` tag to trigger `.github/workflows/ci-publish.yml`, which sets the Maven
version from the tag, builds, tests, GPG-signs, and publishes to Maven Central:

```bash
git tag v1.7.0
git push origin v1.7.0
```

Monitor the run at:
https://github.com/BEAST2-Dev/model-selection/actions/workflows/ci-publish.yml

### 2. GitHub release (BEAST package ZIP)

First remove `-SNAPSHOT` from `<version>` in `pom.xml` so it matches the release
(e.g. `1.7.0-SNAPSHOT` -> `1.7.0`), then build the installable BEAST package ZIP locally:

```bash
mvn clean package -DskipTests
```

**Note:** if you skip the manual edit above, the build still succeeds, but the module
jar bundled inside the ZIP (`lib/model-selection-<version>.jar`) will carry the
`-SNAPSHOT` suffix — that's meant for dev/testing builds, not an official release.
Alternatively, instead of hand-editing `pom.xml`, run:

```bash
mvn versions:set -DnewVersion=<version> -DgenerateBackupPoms=false
```

The ZIP is written to `target/MODEL_SELECTION.v<version>.zip`. Then manually:

1. Go to https://github.com/BEAST2-Dev/model-selection/releases/new
2. Choose the matching tag (e.g. `v1.7.0`), fill in the release title/notes
3. Upload `target/MODEL_SELECTION.v<version>.zip` as a release asset
4. Publish
Loading
Loading