@arc-e-tect/api-only-publisher 0.18.3 → 0.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.adoc +90 -1
- package/package.json +1 -1
package/README.adoc
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:source-highlighter: rouge
|
|
7
7
|
// The released version of this component: its snippets use it. The release
|
|
8
8
|
// workflow updates it; do not change it by hand.
|
|
9
|
-
:api-only-publisher-version: 0.18.
|
|
9
|
+
:api-only-publisher-version: 0.18.4
|
|
10
10
|
|
|
11
11
|
[NOTE]
|
|
12
12
|
.About this documentation
|
|
@@ -1284,6 +1284,12 @@ They are starting points, not boundaries: the situations describe where each sha
|
|
|
1284
1284
|
|Several
|
|
1285
1285
|
|No
|
|
1286
1286
|
|Parties that each use some of the backend services, with technologies of their own.
|
|
1287
|
+
|
|
1288
|
+
|<<recipe-separate-homes,Separate homes §>>
|
|
1289
|
+
|Several
|
|
1290
|
+
|Several, of one type
|
|
1291
|
+
|No
|
|
1292
|
+
|One library whose contracts are each published to a GitLab project or GitHub repository of their own.
|
|
1287
1293
|
|===
|
|
1288
1294
|
|
|
1289
1295
|
[#recipes-two-facts]
|
|
@@ -1580,6 +1586,89 @@ In an eco-system, give every target a list: a new target then goes nowhere until
|
|
|
1580
1586
|
* `--channel` publishes to one channel alone, say after its registry was unreachable: `npm run apionly -- publish --channel npm` sends `catalog` and `orders`, says that it skipped `customers` and `payments`, and fails if it would publish nothing at all.
|
|
1581
1587
|
* The routing is checked when `apionly.yaml` is read: a target that lists a channel `apionly.yaml` does not configure is refused, naming both, before anything is built.
|
|
1582
1588
|
* A third party that needs a registry of a type another party already uses -- a second Maven repository -- gets a channel of its own, with `type: maven` (<<recipes-two-facts,the two facts §>>).
|
|
1589
|
+
* Targets that each go to a project or repository of their own, all of one type, are the <<recipe-separate-homes,separate homes §>> recipe.
|
|
1590
|
+
|
|
1591
|
+
[#recipe-separate-homes]
|
|
1592
|
+
=== Separate homes: several targets, each published to a project of its own
|
|
1593
|
+
|
|
1594
|
+
*When.*
|
|
1595
|
+
One library holds the contracts of several products, and each product has a GitLab project or GitHub repository of its own, which is where its consumers look for it.
|
|
1596
|
+
The `book` contract belongs in the `Book` project and the `author` contract in the `Author` project, on the same server, and neither should turn up in the other.
|
|
1597
|
+
|
|
1598
|
+
Each destination is a channel of its own: two channels of one type, with names of their own and `type` (<<recipes-two-facts,the two facts §>>).
|
|
1599
|
+
Each target lists the one channel it is published to.
|
|
1600
|
+
|
|
1601
|
+
.apionly.yaml (excerpt), on GitLab
|
|
1602
|
+
[source,yaml]
|
|
1603
|
+
----
|
|
1604
|
+
channels:
|
|
1605
|
+
book:
|
|
1606
|
+
type: gitlab-package
|
|
1607
|
+
url: https://gitlab.example.com/api/v4
|
|
1608
|
+
project: example/Book # an ID or a path
|
|
1609
|
+
tokenEnv: BOOK_DEPLOY_TOKEN # a deploy token of the Book project
|
|
1610
|
+
tokenType: deploy
|
|
1611
|
+
author:
|
|
1612
|
+
type: gitlab-package
|
|
1613
|
+
url: https://gitlab.example.com/api/v4
|
|
1614
|
+
project: example/Author
|
|
1615
|
+
tokenEnv: AUTHOR_DEPLOY_TOKEN # a deploy token of the Author project
|
|
1616
|
+
tokenType: deploy
|
|
1617
|
+
|
|
1618
|
+
targets:
|
|
1619
|
+
book:
|
|
1620
|
+
channels: [book]
|
|
1621
|
+
openapi:
|
|
1622
|
+
bundle: bundles/book_api.yaml
|
|
1623
|
+
author:
|
|
1624
|
+
channels: [author]
|
|
1625
|
+
openapi:
|
|
1626
|
+
bundle: bundles/author_api.yaml
|
|
1627
|
+
----
|
|
1628
|
+
|
|
1629
|
+
.apionly.yaml (excerpt), on GitHub
|
|
1630
|
+
[source,yaml]
|
|
1631
|
+
----
|
|
1632
|
+
channels:
|
|
1633
|
+
book:
|
|
1634
|
+
type: github-release
|
|
1635
|
+
repository: example/Book
|
|
1636
|
+
author:
|
|
1637
|
+
type: github-release
|
|
1638
|
+
repository: example/Author
|
|
1639
|
+
|
|
1640
|
+
targets:
|
|
1641
|
+
book:
|
|
1642
|
+
channels: [book]
|
|
1643
|
+
openapi:
|
|
1644
|
+
bundle: bundles/book_api.yaml
|
|
1645
|
+
author:
|
|
1646
|
+
channels: [author]
|
|
1647
|
+
openapi:
|
|
1648
|
+
bundle: bundles/author_api.yaml
|
|
1649
|
+
----
|
|
1650
|
+
|
|
1651
|
+
[source,console]
|
|
1652
|
+
----
|
|
1653
|
+
npm run apionly -- build
|
|
1654
|
+
npm run apionly -- publish
|
|
1655
|
+
----
|
|
1656
|
+
|
|
1657
|
+
One run publishes the generic package `book` in the `Book` project and `author` in the `Author` project, or the releases `book-v<version>` in `example/Book` and `author-v<version>` in `example/Author`.
|
|
1658
|
+
|
|
1659
|
+
*Worth knowing.*
|
|
1660
|
+
|
|
1661
|
+
* Give every target a `channels` list.
|
|
1662
|
+
A target without one is published to every configured channel, so it would turn up in both projects.
|
|
1663
|
+
* On GitLab, the job token and `CI_PROJECT_ID` reach only the project the pipeline runs in, so publishing into other projects takes a deploy token of each, with `write_package_registry` and `read_package_registry`, in a masked CI/CD variable that the channel's `tokenEnv` names (link:../docs/guides/publishing-to-gitlab/overview.adoc#tokens[Publishing to GitLab: which token →]).
|
|
1664
|
+
A channel for the pipeline's own project needs none of `url`, `project` and the token settings.
|
|
1665
|
+
* A deploy token cannot create a release, so `release: true` on a channel with `tokenType: deploy` is refused; such a channel needs a project access token with the `api` scope instead (<<gitlab-package,The `gitlab-package` channel §>>).
|
|
1666
|
+
* On GitHub, a `github-release` channel has no `tokenEnv`: it publishes with the GitHub CLI's own credential, `GH_TOKEN` for instance, the same for every channel.
|
|
1667
|
+
That one credential has to be able to write releases in both repositories.
|
|
1668
|
+
A workflow's own `GITHUB_TOKEN` reaches only the repository it runs in, so publishing to two other repositories takes a fine-grained token or a GitHub App token that covers both (https://github.com/Arc-E-Tect/SoftwareEngineeringDoneRight-API/issues/111[issue #111 ↗] asks for a credential per channel).
|
|
1669
|
+
* On GitHub, a release whose tag does not exist yet is tagged on the head of the destination repository's default branch, not on the commit that was published (https://github.com/Arc-E-Tect/SoftwareEngineeringDoneRight-API/issues/112[issue #112 ↗]).
|
|
1670
|
+
* `--channel` publishes one destination on its own: `npm run apionly -- publish --channel author` sends `author`, and says that it skipped `book`.
|
|
1671
|
+
* Products that also need other channels list those too: `channels: [book, maven]` publishes `book` to its project and to the Maven repository.
|
|
1583
1672
|
|
|
1584
1673
|
[#behaviour]
|
|
1585
1674
|
== Behaviour worth knowing about
|
package/package.json
CHANGED