1# Publish a CUE module under a private GitHub repository namespace
2# where `cue login` has been set up with read-write access to the namespace.
3# Publish a version for this new repository with `cue mod publish`,
4# and then fetch the module as a dependency via cmd/cue.
5
6github-repo-module private
7env VERSION=v0.0.1
8env MODVER=${MODULE}@v0
9
10cd publish
11
12exec cue mod init --source self ${MODVER}
13exec cue mod publish ${VERSION}
14
15cd ../depend
16
17env-fill out_foo.cue
18exec cue mod init --source self depend.localhost
19exec cue mod tidy
20exec cue export
21cmp stdout export.golden
22
23# TODO(mvdan): Use another registry token without access to this private repo
24# and check that they cannot list, fetch, or publish any versions.
25
26-- publish/foo.cue --
27package publish
28
29foo: "foo value"
30
31-- depend/out_foo.cue --
32package depend
33
34import mt "${MODVER}:publish"
35
36out: mt.foo
37-- depend/export.golden --
38{
39 "out": "foo value"
40}