Skip to content

Commit d400b72

Browse files
committed
chore(moonzero): publish under the moonbitstack namespace on mooncakes, with an opt-in release workflow.
Signed-off-by: Leo Cheng (heke1228) <chengkelfan@qq.com>
1 parent 30e5808 commit d400b72

23 files changed

Lines changed: 115 additions & 49 deletions

File tree

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release
2+
3+
# A version tag publishes this module to mooncakes under the moonbitstack account. Publishing is
4+
# opt-in: the publish job runs only while the organization (or repository) variable
5+
# MOONCAKES_PUBLISH is 'true', so a tag with the switch off only runs the tests.
6+
on:
7+
push:
8+
tags: ["v*"]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
persist-credentials: false
21+
22+
- name: install moonbit
23+
run: |
24+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
25+
echo "$HOME/.moon/bin" >> "$GITHUB_PATH"
26+
27+
- name: test
28+
run: |
29+
moon update
30+
moon check --target all --deny-warn
31+
moon test --target all
32+
33+
publish:
34+
needs: test
35+
if: vars.MOONCAKES_PUBLISH == 'true'
36+
runs-on: ubuntu-latest
37+
environment: mooncakes
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
persist-credentials: false
42+
43+
- name: install moonbit
44+
run: |
45+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
46+
echo "$HOME/.moon/bin" >> "$GITHUB_PATH"
47+
48+
- name: check tag and namespace
49+
run: |
50+
version="$(sed -n 's/^version = "\(.*\)"/\1/p' moon.mod)"
51+
grep -q '^name = "moonbitstack/' moon.mod || { echo "::error::moon.mod is not under moonbitstack"; exit 1; }
52+
if [ "$GITHUB_REF_TYPE" = tag ] && [ "${GITHUB_REF_NAME##*v}" != "$version" ]; then
53+
echo "::error::tag $GITHUB_REF_NAME does not match moon.mod version $version"; exit 1
54+
fi
55+
56+
- name: publish
57+
env:
58+
CREDENTIALS: ${{ secrets.MOONCAKES_CREDENTIALS }}
59+
run: |
60+
if [ -z "$CREDENTIALS" ]; then echo "::error::MOONCAKES_CREDENTIALS is not available"; exit 1; fi
61+
trap 'rm -f ~/.moon/credentials.json' EXIT
62+
printf '%s' "$CREDENTIALS" > ~/.moon/credentials.json
63+
moon update
64+
moon publish

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
[![Check and Test](https://github.com/moonbitstack/moonzero/actions/workflows/ci.yml/badge.svg)](https://github.com/moonbitstack/moonzero/actions/workflows/ci.yml)
88
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](./LICENSE)
9-
[![mooncakes](https://img.shields.io/badge/mooncakes-Lfan--ke%2Fmoonzero-brightgreen)](https://mooncakes.io/docs/Lfan-ke/moonzero)
9+
[![mooncakes](https://img.shields.io/badge/mooncakes-Lfan--ke%2Fmoonzero-brightgreen)](https://mooncakes.io/docs/moonbitstack/moonzero)
1010

1111
</div>
1212

13+
> Moved on mooncakes from `Lfan-ke/moonzero` to `moonbitstack/moonzero`.
14+
1315
`moonzero` is the integration layer of the **moon\*** suite — the role `go-zero` plays for Go. It assembles a [`moonapi`](https://github.com/moonbitstack/moonapi) application from config, wraps it in middleware, and produces a runnable [`moonasgi`](https://github.com/moonbitstack/moonasgi) `AsgiApp` that a server (`mooncat`) runs. It depends only on `moonapi` + `moonasgi`, so it stays backend-agnostic.
1416

1517
```mermaid

discov/moon.pkg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
supported_targets = "native"
66

77
import {
8-
"Lfan-ke/moonzero",
9-
"Lfan-ke/moonrpc",
10-
"Lfan-ke/moonrpc/net",
8+
"moonbitstack/moonzero",
9+
"moonbitstack/moonrpc",
10+
"moonbitstack/moonrpc/net",
1111
"moonbitlang/async",
1212
"moonbitlang/async/fs",
1313
"moonbitlang/async/io",
1414
"moonbitlang/async/socket",
1515
}
1616

1717
import {
18-
"Lfan-ke/moonapi",
19-
"Lfan-ke/moonasgi",
18+
"moonbitstack/moonapi",
19+
"moonbitstack/moonasgi",
2020
"moonbitlang/async",
2121
"moonbitlang/core/env",
2222
"moonbitlang/core/encoding/utf8",

docs/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@
115115
<a href="#redis"><span class="at">§</span>redis</a>
116116
<a href="#transports"><span class="at">§</span>Native transports</a>
117117
<a href="#limiting"><span class="at">§</span>Admission control</a>
118-
</nav><button class="theme-btn" id="theme">◐ toggle theme</button><div class="side-foot"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><a href="https://mooncakes.io/docs/Lfan-ke/moonzero"><img alt="mooncakes" src="https://img.shields.io/badge/mooncakes-Lfan--ke%2Fmoonzero-1f6feb"></a></div></aside>
119-
<main><header class="hero"><h1>moonzero</h1><p class="tag">A service framework for MoonBit &#8212; config-driven assembly of a moonapi app with middleware into a runnable AsgiApp, the way go-zero does for Go. Backend-agnostic; served by mooncat.</p><div class="badges"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><img alt="tests" src="https://img.shields.io/badge/tests-110%20passing-0ca678"><a href="https://github.com/moonbitstack/moonzero"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-source-24292f?logo=github"></a><img alt="license" src="https://img.shields.io/badge/license-Apache--2.0-6d5efc"></div><div class="install"><span class="prompt">$</span><code>moon add Lfan-ke/moonzero</code><button class="copy" data-copy="moon add Lfan-ke/moonzero">copy</button></div><div class="contract"><h2><span class="spark">&#10038;</span> The contract at a glance</h2><pre><span class="k">let</span> conf = <span class="ty">ServiceConf</span>::new(name=&quot;greet&quot;, port=8888)
118+
</nav><button class="theme-btn" id="theme">◐ toggle theme</button><div class="side-foot"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><a href="https://mooncakes.io/docs/moonbitstack/moonzero"><img alt="mooncakes" src="https://img.shields.io/badge/mooncakes-Lfan--ke%2Fmoonzero-1f6feb"></a></div></aside>
119+
<main><header class="hero"><h1>moonzero</h1><p class="tag">A service framework for MoonBit &#8212; config-driven assembly of a moonapi app with middleware into a runnable AsgiApp, the way go-zero does for Go. Backend-agnostic; served by mooncat.</p><div class="badges"><a href="https://github.com/moonbitstack/moonzero/actions"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/moonbitstack/moonzero/ci.yml?branch=master&label=CI&logo=github"></a><img alt="tests" src="https://img.shields.io/badge/tests-110%20passing-0ca678"><a href="https://github.com/moonbitstack/moonzero"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-source-24292f?logo=github"></a><img alt="license" src="https://img.shields.io/badge/license-Apache--2.0-6d5efc"></div><div class="install"><span class="prompt">$</span><code>moon add moonbitstack/moonzero</code><button class="copy" data-copy="moon add moonbitstack/moonzero">copy</button></div><div class="contract"><h2><span class="spark">&#10038;</span> The contract at a glance</h2><pre><span class="k">let</span> conf = <span class="ty">ServiceConf</span>::new(name=&quot;greet&quot;, port=8888)
120120
<span class="k">let</span> server = <span class="ty">Server</span>::new(conf, app).use_(logging)
121121

122122
server.describe() // &quot;greet listening on 0.0.0.0:8888&quot;
@@ -580,7 +580,7 @@
580580
<div class="item" data-k="item"><span class="kind">item</span><pre class="sig"><span class="k">async</span> <span class="k">fn</span> <span class="ty">RedisPeriodLimit</span>::take( self : <span class="ty">RedisPeriodLimit</span>, key : <span class="ty">String</span>) <span class="op">-&gt;</span> <span class="ty">PeriodResult</span> raise <span class="ty">RedisError</span></pre><p class="doc">Account for one request under <code>key</code> and report its outcome, in the same three states the local limiter reports. A code the script cannot have returned, or a reply that is not an integer at all, raises — go-zero answers <code>Unknown</code> with <code>ErrUnknownCode</code> there, and a caller has to decide what an undecided limiter means.</p></div>
581581
<div class="item" data-k="fn"><span class="kind">fn</span><pre class="sig"><span class="k">fn</span> redis_period_limit( limiter : <span class="ty">RedisPeriodLimit</span>, key<span class="op">?</span> : <span class="ty">String</span> = &quot;global&quot;) <span class="op">-&gt;</span> <span class="ty">Middleware</span></pre><p class="doc">Fixed-window rate-limit middleware over a shared redis: <code>period_limit</code> with the window in redis, so replicas behind one redis spend one quota between them. A redis that cannot be reached admits the request — the limiter is a guard on the service, not a dependency that should be able to close it.</p></div>
582582
</section>
583-
<footer>Generated from source <code>///</code> doc-comments · <a href="https://mooncakes.io/docs/Lfan-ke/moonzero">mooncakes</a> · <a href="https://github.com/moonbitstack/moonzero">GitHub</a> · Apache-2.0 &#169; Leo Cheng</footer>
583+
<footer>Generated from source <code>///</code> doc-comments · <a href="https://mooncakes.io/docs/moonbitstack/moonzero">mooncakes</a> · <a href="https://github.com/moonbitstack/moonzero">GitHub</a> · Apache-2.0 &#169; Leo Cheng</footer>
584584
</main></div><script>
585585
document.addEventListener("DOMContentLoaded",()=>{
586586
document.querySelectorAll("[data-copy]").forEach(btn=>btn.addEventListener("click",()=>{

examples/00-metrics/moon.pkg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
supported_targets = "native"
44

55
import {
6-
"Lfan-ke/moonzero",
7-
"Lfan-ke/moonapi",
8-
"Lfan-ke/moonasgi",
6+
"moonbitstack/moonzero",
7+
"moonbitstack/moonapi",
8+
"moonbitstack/moonasgi",
99
"moonbitlang/async",
1010
}
1111

examples/01-config/moon.pkg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
"Lfan-ke/moonzero",
2+
"moonbitstack/moonzero",
33
}
44

55
pkgtype(kind: "executable")

examples/02-middleware/moon.pkg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
supported_targets = "native"
44

55
import {
6-
"Lfan-ke/moonzero",
7-
"Lfan-ke/moonapi",
8-
"Lfan-ke/moonasgi",
6+
"moonbitstack/moonzero",
7+
"moonbitstack/moonapi",
8+
"moonbitstack/moonasgi",
99
"moonbitlang/async",
1010
}
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
"Lfan-ke/moonzero",
2+
"moonbitstack/moonzero",
33
}
44

55
pkgtype(kind: "executable")

examples/04-resilience-mw/moon.pkg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
supported_targets = "native"
44

55
import {
6-
"Lfan-ke/moonzero",
7-
"Lfan-ke/moonapi",
8-
"Lfan-ke/moonasgi",
6+
"moonbitstack/moonzero",
7+
"moonbitstack/moonapi",
8+
"moonbitstack/moonasgi",
99
"moonbitlang/async",
1010
}
1111

examples/05-jwt-crypto/moon.pkg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
"Lfan-ke/moonzero",
2+
"moonbitstack/moonzero",
33
"moonbitlang/core/encoding/utf8",
44
}
55

0 commit comments

Comments
 (0)