diff --git a/.github/workflows/assemble.yml b/.github/workflows/assemble.yml index 12e1533..f804ebe 100644 --- a/.github/workflows/assemble.yml +++ b/.github/workflows/assemble.yml @@ -2,7 +2,7 @@ name: assemble dictionary # Stage B (lightweight): merge cached + live sources, filter, score, emit a # `.combined` wordlist; open a PR for human review. The compiled `.dict` is -# produced from a merged PR by the release-dict workflow (not yet authored). +# produced and published on release by release.yml (Release Please). on: schedule: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..07b8004 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,70 @@ +name: release + +# Release Please maintains a release PR from Conventional Commits on main. +# When that PR merges, it tags the commit and creates a GitHub Release; the +# publish-dict job then compiles the puhekieli `.dict` and attaches it to the +# release as a stable, versioned download (consumed by Workstream B). + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + publish-dict: + needs: release-please + if: ${{ needs.release-please.outputs.release_created == 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ needs.release-please.outputs.tag_name }} + - name: install libvoikko + Finnish dictionary + run: | + sudo apt-get update + sudo apt-get install -y libvoikko-dev voikko-fi + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - uses: extractions/setup-just@v2 + - name: set up JDK (for dicttool) + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + - name: build .combined + compile .dict + # Downloads the OpenSubtitles corpus + dicttool jar, assembles the + # wordlist (always includes the committed curated seed; Mastodon is + # skipped — no cache in a fresh checkout), and compiles the .dict. + run: just generate + - name: stage versioned artifacts + env: + TAG: ${{ needs.release-please.outputs.tag_name }} + run: | + mkdir -p dist + cp data/out/puhekieli_fi.dict "dist/puhekieli_fi-${TAG}.dict" + cp data/out/niinku.combined "dist/niinku-${TAG}.combined" + ls -l dist + - name: attach artifacts to the release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ needs.release-please.outputs.tag_name }} + run: gh release upload "$TAG" dist/* --clobber diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..b985ff6 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} diff --git a/Cargo.toml b/Cargo.toml index d22b3cf..b80a35b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" license = "MIT" repository = "https://github.com/laurigates/niinku" authors = ["Lauri Gates"] -version = "0.0.1" +version = "0.0.1" # x-release-please-version [workspace.dependencies] anyhow = "1" diff --git a/README.md b/README.md index 9397b83..4cab2bc 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,11 @@ just ingest-mastodon # pull Finnish hashtag posts → data/cached/mastodon-fi.tx just ingest # pass through to the CLI (e.g. `just ingest mastodon --tags suomi`) ``` -The `.dict` file ships at `data/out/puhekieli_fi.dict`. To use it: +Pre-built `.dict` files are attached to each +[GitHub Release](https://github.com/laurigates/niinku/releases) as +`puhekieli_fi-.dict` (built automatically — see CI/CD below). +You can also build one locally with `just generate`, which writes +`data/out/puhekieli_fi.dict`. To use it: 1. Transfer to an Android device that has HeliBoard installed. 2. Settings → Languages → Finnish → "Add dictionary from file" → select the `.dict`. @@ -164,8 +168,13 @@ it. - Scheduled `cron` (monthly suggested) runs Stage B. - The job does **not** auto-publish. It opens a PR containing the regenerated wordlist plus a diff of new-vs-removed entries. A human merges. -- On merge, the compiled `.dict` is published as a GitHub Release artifact at - a stable URL (consumed by Workstream B). +- Releases are cut by [Release Please](https://github.com/googleapis/release-please) + (`release.yml`): it maintains a release PR from Conventional Commits on + `main`; merging it tags the commit and creates a GitHub Release. +- On release, `release.yml` compiles the `.dict` and attaches it (plus the + `.combined` source) to the release as a stable, versioned download + (consumed by Workstream B). Version bumps are driven by commit type + (`feat:` → minor, `fix:` → patch) — see [Conventional Commits](https://www.conventionalcommits.org). ### Repo layout @@ -181,6 +190,7 @@ it. /.github/workflows ingest.yml # Stage A, manual / version-triggered assemble.yml # Stage B, cron + PR + release.yml # Release Please + compile/publish .dict on release ci.yml # fmt, clippy, test /tools dicttool_aosp.jar # not yet vendored diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..01f6914 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "simple", + "package-name": "niinku", + "changelog-path": "CHANGELOG.md", + "include-component-in-tag": false, + "extra-files": [ + "Cargo.toml" + ] + } + } +}