diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..b6861d8 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,134 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: short + +jobs: + build: + name: build ${{ matrix.target }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - x86_64-unknown-linux-gnu + - aarch64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - aarch64-unknown-linux-musl + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@1.83 + with: + targets: ${{ matrix.target }} + + - name: Cache cargo state + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-release-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-release-${{ matrix.target }}- + + - name: Install cross + run: | + if ! command -v cross >/dev/null 2>&1; then + cargo install cross --locked --version 0.2.5 + fi + + - name: Cross-compile nuwiki-ls + run: cross build --release --target ${{ matrix.target }} -p nuwiki-ls + + - name: Package archive + id: package + run: | + set -euo pipefail + version="${GITHUB_REF_NAME#v}" + archive="nuwiki-ls-${version}-${{ matrix.target }}.tar.gz" + tar -czf "$archive" -C "target/${{ matrix.target }}/release" nuwiki-ls + echo "archive=$archive" >> "$GITHUB_OUTPUT" + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: nuwiki-ls-${{ matrix.target }} + path: ${{ steps.package.outputs.archive }} + if-no-files-found: error + retention-days: 7 + + release: + name: gitea release + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Download all build artifacts + uses: actions/download-artifact@v4 + with: + path: ./artifacts + merge-multiple: true + + - name: Ensure jq + curl + run: | + if ! command -v jq >/dev/null 2>&1; then + apt-get update && apt-get install -y --no-install-recommends jq + fi + if ! command -v curl >/dev/null 2>&1; then + apt-get update && apt-get install -y --no-install-recommends curl + fi + + - name: Create Gitea release + upload assets + env: + RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} + GITEA_SERVER: ${{ github.server_url }} + REPO: ${{ github.repository }} + TAG: ${{ github.ref_name }} + run: | + set -euo pipefail + if [ -z "${RELEASE_TOKEN:-}" ]; then + echo "::error::RELEASE_TOKEN secret is not set" + exit 1 + fi + echo "Releasing $TAG to $GITEA_SERVER/$REPO" + + payload=$(jq -n --arg tag "$TAG" --arg name "$TAG" \ + '{tag_name: $tag, name: $name, draft: false, prerelease: false}') + + release_id=$(curl --fail --silent --show-error \ + -H "Authorization: token $RELEASE_TOKEN" \ + -H "Content-Type: application/json" \ + -d "$payload" \ + "$GITEA_SERVER/api/v1/repos/$REPO/releases" \ + | jq -r '.id') + + if [ -z "$release_id" ] || [ "$release_id" = "null" ]; then + echo "::error::failed to create release" + exit 1 + fi + echo "Created release id=$release_id" + + for archive in artifacts/*.tar.gz; do + name="$(basename "$archive")" + echo "Uploading $name …" + curl --fail --silent --show-error \ + -H "Authorization: token $RELEASE_TOKEN" \ + -H "Content-Type: application/gzip" \ + --data-binary "@$archive" \ + "$GITEA_SERVER/api/v1/repos/$REPO/releases/$release_id/assets?name=$name" \ + >/dev/null + done + echo "All assets uploaded." diff --git a/README.md b/README.md index d1ed7af..d61ec72 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,10 @@ A Vim/Neovim plugin providing full vimwiki syntax support, implemented as a Rust-based language server (LSP). -> **Status:** Phase 9 (editor glue) complete. Plugin installable via -> lazy.nvim / vim-plug / Dein; setup() + LSP wiring + binary downloader + -> :checkhealth ship. Only the release pipeline remains. +> **Status:** All phases (0–10) complete. v1 feature set landed: +> editor-independent core, vimwiki lexer + parser, HTML renderer, +> tower-lsp server with diagnostics + outline + semantic tokens + +> navigation + workspace index, plugin glue, and release pipeline. See [`SPEC.md`](./SPEC.md) for the full project specification. @@ -23,7 +24,7 @@ See [`SPEC.md`](./SPEC.md) for the full project specification. | 7 | Semantic Tokens | ✅ done | | 8 | Navigation | ✅ done | | 9 | Editor Glue | ✅ done | -| 10 | CI/CD release pipeline | ⏳ next | +| 10 | CI/CD release pipeline | ✅ done | ## Repository layout diff --git a/SPEC.md b/SPEC.md index 30872a0..3dd35c4 100644 --- a/SPEC.md +++ b/SPEC.md @@ -1,7 +1,7 @@ # nuwiki — Project Specification > Last updated: 2026-05-10 -> Status: Phase 9 (Editor Glue) complete — moving to Phase 10 (CI/CD release pipeline) +> Status: All phases (0–10) complete --- @@ -449,7 +449,7 @@ require('nuwiki').setup({ - Cross-compile for all 4 Linux targets using `cross` - Package binaries as `.tar.gz` - Create Gitea release and upload assets via REST API using `RELEASE_TOKEN` secret -- Publish `nuwiki-core` to crates.io using `CARGO_REGISTRY_TOKEN` secret +- crates.io publish is deferred — workflow ships the Gitea release only. Re-enable by adding a `cargo publish -p nuwiki-core` job once the crate is ready for publication. ### 8.3 Build Targets @@ -468,7 +468,7 @@ require('nuwiki').setup({ | Secret | Purpose | |---|---| | `RELEASE_TOKEN` | Gitea personal access token for creating releases and uploading assets | -| `CARGO_REGISTRY_TOKEN` | crates.io API token for publishing `nuwiki-core` | +| ~~`CARGO_REGISTRY_TOKEN`~~ | ~~crates.io API token for publishing `nuwiki-core`~~ — deferred (see §8.2) | ### 8.5 `actions/cache` Configuration @@ -592,5 +592,4 @@ These decisions are required before or during the phase indicated. | ~~P6~~ | ~~**Minimum Vim version**~~ | ~~Phase 9~~ | ✅ **Vim 9.1+** | autoload glue assumes 9.1 idioms; uses `vim-lsp` first, then falls back to `coc.nvim`. | | ~~P7~~ | ~~**Semantic token type mapping**~~ | ~~Phase 7~~ | ✅ **Custom vimwiki-specific token types** | ~20 types (`vimwikiHeading`, `vimwikiBold`, …) + `level1`..`level6` + `centered` modifiers. Phase 9 ships default highlight groups in `syntax/nuwiki.vim` and the Lua glue. | | ~~P8~~ | ~~**Workspace indexing strategy**~~ | ~~Phase 8~~ | ✅ **Lazy + background with progress** | Initial scan runs as a background tokio task; nav features answer with partial data until complete; progress reported via `window/workDoneProgress`. | -| P9 | **macOS runner** | Phase 10 | Stay manual · Register macOS runner -| Revisit if a Mac is available; no action needed now | +| ~~P9~~ | ~~**macOS runner**~~ | ~~Phase 10~~ | ✅ **Stay manual** | Release workflow cross-compiles the 4 Linux targets via `cross`; macOS + Windows binaries are produced ad hoc by maintainers and uploaded to the same Gitea release. Revisit when a Mac runner is available. |