Skip to content

release: v0.5.0 - sync_invoices saveDir + cfnode1 CI migration - #11

Closed
luke-cf wants to merge 6 commits into
prodfrom
main
Closed

release: v0.5.0 - sync_invoices saveDir + cfnode1 CI migration#11
luke-cf wants to merge 6 commits into
prodfrom
main

Conversation

@luke-cf

@luke-cf luke-cf commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Re-open of #9 (closed by buggy guard-prod, fixed in #10). Merging this triggers the new 4-job release pipeline to publish @ksefnik/* v0.5.0 and deploy docs.

What ships

Pipeline (5 jobs)

Job Runs on What
verify cfnode1 install + build + typecheck + test, uploads dist artifacts
publish-npm cfnode1 bump to v0.5.0, publish 6 packages with provenance, tag v0.5.0, GH release
build-docs cfnode1 build docs image from v0.5.0 tag, push to ghcr.io/codeformers-it/ksefnik-docs
deploy vps-codeformers pull new image, restart container, smoke-test :7020
sync-back ubuntu-latest open PR prod → main with the version bump

luke-cf added 6 commits May 27, 2026 11:07
Build & push (docs.yml, prod-release.yml) now run on self-hosted [self-hosted, codeformers]
(cfnode1) with GHCR auth via GITHUB_TOKEN instead of a long-lived PAT mounted on
the host - no more ~/.env.ksefnik dependency, no more macmini-specific paths.

Deploy step moved from `ssh codeformers "..."` to a separate job pinned to
[self-hosted, vps-codeformers] which runs the deploy.sh on the docs VPS directly.
That removes the SSH key on the build host and lets us add more VPSes later by
just registering more org runners with the codeformers-vps / vps-shared / vps-<name>
label triple.

VPS-side .env (REPO_TOKEN_GITHUB_PAT) is untouched - kept for `docker pull` after
the job ends (consistent with OxStudio's vps-prod convention).
Previous pipeline crammed everything (install, build, test, bump, npm publish,
git tag, GH release, docker build, GHCR push, VPS deploy) into one job. If any
step past 'npm publish' failed, the release was left in an inconsistent state
(packages on npm, no tag in git, no docker image, no VPS deploy) with no clean
way to retry just the failed stage.

New shape:
  verify       - install/build/typecheck/test on the current SHA, uploads dist.
                 Pure validation, mutates nothing, safe to rerun.
  publish-npm  - downloads dist, bumps versions, publishes to npm, commits +
                 tags + GH release. After this job the new vX.Y.Z tag exists
                 on origin/prod.
  build-docs   - checks out the v${VERSION} tag, builds the docs image, pushes
                 to GHCR. Re-running this job is idempotent (same tag → same
                 image content), so a flaky GHCR push can be retried alone.
  deploy       - pulls the new image on the VPS, recreates the container,
                 smoke-tests. Re-running just pulls latest again.
  sync-back    - opens a PR prod → main so the bump lands back in main.

Added workflow_dispatch with dry_run=true (default). Lets us validate the whole
verify path without publishing or tagging - useful for testing pipeline changes
without burning a real release version.
Adds an opt-in `saveDir` parameter to the sync_invoices MCP tool. When set,
the tool fetches the full FA(2)/FA(3) XML for each invoice (via the existing
fetchInvoiceXml HTTP path) and writes one file per invoice to
${saveDir}/${ksefReferenceNumber}.xml. mkdir -p semantics, absolute or
relative paths accepted (relative resolved against cwd of the MCP host).

Plumbing for the new option:
  shared    FetchInvoicesOpts.includeXml: documents the flag + that rawXml
            lands on Invoice.rawXml when set (was already handled by adapter).
  core      KsefClient.fetchInvoices gains optional includeXml. KsefAdapter
            forwards it to the underlying client.
  http      KsefHttpClient.fetchInvoices forwards includeXml. Adds
            fetchInvoiceXml(token, ksefNumber) public method backed by the
            existing http/invoices.ts helper so non-MCP consumers can also
            grab single XMLs.

Default behavior unchanged — fetchInvoices without includeXml still returns
metadata only.
feat(mcp): saveDir option for sync_invoices tool
Previous implementation called gh api orgs/<org>/members/<user> with the workflow's
GITHUB_TOKEN. The token authenticates as github-actions[bot] which is NOT an org
member, so the API returns 404 for members whose membership is private - the script
read that as "external contributor" and closed the PR.

Symptom: PR main → prod opened by an admin/maintainer was auto-closed with the
"PRs to prod are restricted to org members" comment. push:prod events were
unaffected because guard-prod only runs on pull_request_target.

Fix: use github.event.pull_request.author_association which GitHub already
computes server-side per event. Values OWNER, MEMBER, COLLABORATOR allow the PR;
anything else (CONTRIBUTOR / FIRST_TIME_CONTRIBUTOR / NONE) closes it.

No extra API call, no token scope dependency, no private-membership false negatives.
…ciation

fix(ci): guard-prod uses author_association instead of org members API
@github-actions

Copy link
Copy Markdown
Contributor

PRs to prod are restricted to org members. Please open your PR against main instead.

@github-actions github-actions Bot closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant