launchset 0.0.0-stage → 1.2.0
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/LICENSE +21 -0
- package/README.md +100 -2
- package/dist/appstore-bVSJnUv2.js +143 -0
- package/dist/cli.js +6889 -0
- package/dist/errors-CHdD4g_K.js +58 -0
- package/dist/gitlab-child-girdQprO.js +6071 -0
- package/dist/http-dQt8kfON.js +127 -0
- package/dist/index.d.ts +854 -0
- package/dist/index.js +29 -0
- package/dist/init-Cv748KKZ.js +8222 -0
- package/dist/launchset.schema.json +1473 -0
- package/dist/play-D7nv0n-W.js +123 -0
- package/dist/prompts-S8h8cgml.js +52 -0
- package/dist/schema-CKljQNeI.js +1202 -0
- package/dist/store-BCwWrhhY.js +73 -0
- package/package.json +88 -4
- package/skills/launchset/AGENTS-snippet.md +24 -0
- package/skills/launchset/SKILL.md +205 -0
- package/skills/launchset-adopt/SKILL.md +222 -0
- package/templates/gitlab/child/build.yml +17 -0
- package/templates/gitlab/child/cli.yml +14 -0
- package/templates/gitlab/child/comment.yml +14 -0
- package/templates/gitlab/child/finalize.yml +14 -0
- package/templates/gitlab/child/header.yml +4 -0
- package/templates/gitlab/child/include.yml +6 -0
- package/templates/gitlab/child/nothing.yml +11 -0
- package/templates/gitlab/gitlab-ci.yml +23 -0
- package/templates/gitlab/launchset-preview.yml +62 -0
- package/templates/gitlab/launchset-targets.yml +44 -0
- package/templates/gitlab/launchset.yml +133 -0
- package/templates/gitlab/targets/android.yml +25 -0
- package/templates/gitlab/targets/custom-npm.yml +15 -0
- package/templates/gitlab/targets/custom.yml +23 -0
- package/templates/gitlab/targets/docker.yml +23 -0
- package/templates/gitlab/targets/ios.yml +33 -0
- package/templates/gitlab/targets/web.yml +13 -0
- package/templates/launchset-readme.md +23 -0
- package/templates/workflows/launchset-check.yml +33 -0
- package/templates/workflows/launchset-preview.yml +157 -0
- package/templates/workflows/launchset-release.yml +181 -0
- package/templates/workflows/snippets/android.yml +41 -0
- package/templates/workflows/snippets/custom-example.yml +12 -0
- package/templates/workflows/snippets/custom-npm.yml +19 -0
- package/templates/workflows/snippets/custom.yml +9 -0
- package/templates/workflows/snippets/docker-login.yml +9 -0
- package/templates/workflows/snippets/docker.yml +17 -0
- package/templates/workflows/snippets/ios.yml +46 -0
- package/templates/workflows/snippets/web.yml +20 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: launchset-adopt
|
|
3
|
+
description: Use when asked to set up launchset in a repo, move a repo to launchset, migrate a repo from Changesets, tag-triggered release workflows or hand-made release scripts to launchset, or adopt "one version, many targets" releases (Docker, Android, iOS, web), including repos that also publish independently versioned npm packages with Changesets. Covers the whole procedure: detect, ask the human the right questions, retire conflicting release machinery, run launchset init with decisions, and open one PR. Not for working in a repo that already uses launchset (that is the launchset skill).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Move a repo to launchset
|
|
7
|
+
|
|
8
|
+
launchset releases repos where **one version** drives **many targets** (Docker images, Android, iOS and web apps) from one repo. Developers add a small changeset file to each PR. launchset collects them into a release PR. Merging it releases every target. launchset builds nothing: the team's own workflow steps do.
|
|
9
|
+
|
|
10
|
+
You are moving an **existing** repo onto it. This works on GitHub and on GitLab (GitLab.com or self-managed 18.2+); the steps below name both where they differ. The CLI does the detecting and the writing. Your job is to ask the human the right questions, deal with what conflicts, move the team's build steps, and deliver one reviewable PR.
|
|
11
|
+
|
|
12
|
+
Use `npx launchset` (Node 24 or newer). If `npx` can't run it, tell the human and stop.
|
|
13
|
+
|
|
14
|
+
## The rules
|
|
15
|
+
|
|
16
|
+
1. **Detect first. Write nothing until the human has seen the decisions.** `init --detect` never writes.
|
|
17
|
+
2. **Ask only what matters**, with the evidence. Don't ask about decisions whose default is clearly right.
|
|
18
|
+
3. **Never handle secret values.** Certificates, keys, passwords, tokens and service accounts are created and stored by a human. You check names, never values.
|
|
19
|
+
4. **Never lower a version, and never create a baseline tag, without the human's explicit answer.**
|
|
20
|
+
5. **Keep existing conventions** (tag format, Docker image tags) unless the human decides otherwise. Deploy tooling depends on them.
|
|
21
|
+
6. **Remove or adapt conflicting machinery only after the human agrees.**
|
|
22
|
+
7. **Don't migrate what doesn't fit**, and say why (see the end).
|
|
23
|
+
8. **Look up action versions; don't trust what you remember.** Your knowledge of the latest GitHub Action releases is months or years old. Before you write or keep a `uses: owner/repo@vN`, check the latest release, and bump only after you've checked compatibility (see "Check the action versions" in Step 6).
|
|
24
|
+
|
|
25
|
+
## Step 1: Detect
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npx launchset init --detect --json > /tmp/launchset-init.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
(For a human-readable summary: `init --detect`.) Read the JSON. Its shape:
|
|
32
|
+
|
|
33
|
+
- `schemaVersion`: `1`.
|
|
34
|
+
- `detection`: what was found.
|
|
35
|
+
- `versions[]` and `tags[]`: every version found, per file (`source` is `root`, `docker-package`, `native` or `tag`, with `path`, `line`, `key`, `value`, `plain`) and every release-like tag.
|
|
36
|
+
- `canonical`: the proposed version, `reason` and `evidence`.
|
|
37
|
+
- `targets[]`: detected platforms (`name`, `type` `docker|android|ios|web`, `dir`, `source`, `files`, `builtBy`, `proposed` `auto|manual|none`, `reason`, `ask`, and for Docker `docker` with `dockerfile`, `context`, `image`, `tags`).
|
|
38
|
+
- `workflows[]`: existing workflow files and what they build.
|
|
39
|
+
- `machinery[]`: existing release machinery that conflicts, each with `id`, `kinds`, `path`, `line`, `what`, `reasons`, `actions` and `effects`.
|
|
40
|
+
- `imagePins[]`: deploy manifests that pin a Docker image tag (`path`, `target`, `image`, `refs`).
|
|
41
|
+
- `buildNumbers`: the highest build number found, `strategyNow`, and the proposed `offset`.
|
|
42
|
+
- `changesets`: `.changeset/*.md` files to convert, and `preMode`.
|
|
43
|
+
- `hooks[]`: husky, simple-git-hooks or lefthook setups.
|
|
44
|
+
- `notes[]`: warnings and info.
|
|
45
|
+
- `existingConfig`: set when a `launchset.config.*` exists. `init` refuses to overwrite it.
|
|
46
|
+
- `decisions[]`: each with `id`, `question`, `options[]` (`value`, `label`), `freeform` (other values accepted), `default`, `evidence[]` (`path`, `line`, `note`), `ask` (`true` when the default is a guess or a risk) and `onlyIf` (the decision only matters for certain answers to another).
|
|
47
|
+
|
|
48
|
+
If `init` fails with `already-initialized`, the repo already has a config: don't continue. Tell the human.
|
|
49
|
+
|
|
50
|
+
## Step 2: Decide with the human
|
|
51
|
+
|
|
52
|
+
Group the decisions for the human. Ask the ones with `"ask": true`, and these three **always**:
|
|
53
|
+
|
|
54
|
+
1. **Lowering any version.** The default is the highest version found, and it never lowers one. If the human wants a lower one, `--decide version=<lower>` is the only way, and init warns about each file that goes down. Explain: stores reject lower marketing versions, and image tags would go backwards.
|
|
55
|
+
2. **A baseline tag** for a version that has no release tag (`baseline`). A baseline tag makes launchset treat the version as already released, so it never builds it, and pinned images might not exist. Default `yes` only when a tag in another format already marks it as released. Without a baseline tag, if the PR changes the root version, merging it is read as a release of that version and builds every target.
|
|
56
|
+
3. **Native projects that no workflow builds** (`target.<name>`, proposed `manual`). Suggest `release: "manual"` and explain: the version is stamped by every release so native files never drift, but the store build is shipped on demand with a workflow run or `launchset ship`, and the release tag doesn't wait for it. The alternatives are `auto` (every release builds and uploads it) and `none` (not a target).
|
|
57
|
+
|
|
58
|
+
The decision ids and values:
|
|
59
|
+
|
|
60
|
+
| Id | Values | Meaning |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| `host` | `github`, `gitlab` | The code host. Only listed when something points at GitLab (a GitLab remote, `.gitlab-ci.yml`). Check it: it decides which CI files init writes. |
|
|
63
|
+
| `version` | plain `X.Y.Z` | The version the repo is on. |
|
|
64
|
+
| `tags.release` | template with `{version}` | The release tag format. Keep the existing one, for example `{version}` without a `v`. |
|
|
65
|
+
| `target.<name>` | `auto`, `manual`, `none` (`custom`: declare a target init didn't detect) | How a detected platform is released. This includes custom targets from jobs that run on release tags and keep artifacts, deploy or publish: on GitLab named after the job (`package:windows` is `windows`), on GitHub after the workflow file (`desktop-linux.yml` is `desktop-linux`). Their tag trigger is retired, so without the target the build would stop running for releases. `--decide target.<name>=custom` adds a custom target nothing detected, for a project init finds nothing in. |
|
|
66
|
+
| `gitlab.<name>.shell` | `sh`, `powershell` | GitLab custom targets from a job: the runner's shell. `powershell` when the job's scripts use PowerShell or it runs on a `windows`-tagged runner. |
|
|
67
|
+
| `gitlab.templates` | `move`, `keep` | GitLab: move the hidden templates the target jobs extend from `.gitlab-ci.yml` to `.gitlab/ci-templates.yml` (default), which `.gitlab-ci.yml` and the child pipeline (`gitlab.include`) both include. With `keep`, the copied target jobs can't extend them in the child pipeline. |
|
|
68
|
+
| `docker.<name>.image` | image name without a tag | Read from existing workflows, otherwise a guess (`ask`). |
|
|
69
|
+
| `docker.<name>.tags` | `default` or a comma-separated list of templates | Keep the existing tag pattern, for example `v{version}, v{major}.{minor}, v{major}, latest`. |
|
|
70
|
+
| `docker.<name>.verify` | `yes`, `no` | Default `yes`: `verify: ["registry"]`, so a re-run skips an image that is already pushed. |
|
|
71
|
+
| `machinery.<path>#<n>` | `remove`, `disable`, `keep` | What to do with one piece of conflicting machinery. Copy the exact `id` from the JSON (a path starting with a dot gives `machinery..github/workflows/x.yml#1`). |
|
|
72
|
+
| `image.<path>` | `stamp`, `leave` | Whether the release PR updates the image tag a deploy manifest pins. |
|
|
73
|
+
| `file.<path>` | `keep`, `overwrite` | A file init would write already exists (`.launchset/README.md`, `launchset-*.yml`). Default `keep`: it stays as it is. `overwrite` replaces it with the newly generated file. Ask only if the existing file looks hand-edited and should be regenerated. |
|
|
74
|
+
| `baseline` | `yes`, `no` | Create the release tag for the version at HEAD. |
|
|
75
|
+
| `offset` | integer `>= 0` | `buildNumber.offset`, so new build numbers stay above the existing ones. |
|
|
76
|
+
| `skill` | `yes`, `no` | Install the `launchset` skill and an `AGENTS.md` section. |
|
|
77
|
+
| `hook` | `yes`, `no` | Add `launchset check --push` to the existing pre-push hook. Only exists when a hook setup was found. |
|
|
78
|
+
|
|
79
|
+
## Step 3: Find and explain what conflicts
|
|
80
|
+
|
|
81
|
+
launchset pushes its tags and creates GitHub Releases with a GitHub App token, which **does** start other workflows. Look at `detection.machinery[]` and read the files. Explain each in plain words, with `path:line`:
|
|
82
|
+
|
|
83
|
+
- **Tag-triggered workflows** (`on: push: tags: v*` and similar): they would fire again on launchset's release tag and build or publish twice.
|
|
84
|
+
- **Changesets**: `changesets/action`, `changeset version|status|publish|tag` in workflows or `package.json` scripts, `@changesets/write`. launchset's release PR replaces them. Exception: when Changesets also publishes npm packages that have their own versions, it stays for those packages (see "Repos that also publish npm packages" below).
|
|
85
|
+
- **Other release tools** (semantic-release, release-it, standard-version, release-please) and steps that create tags or GitHub Releases (`git tag`, `gh release create`): launchset's finalize creates `v<version>`.
|
|
86
|
+
- **Scripts that write version or build numbers** (`MARKETING_VERSION`, `CURRENT_PROJECT_VERSION`, `versionCode`, `versionName`, fastlane version actions): they would overwrite the numbers stamped in CI.
|
|
87
|
+
- **Docker pushes of `latest` on branch pushes**: launchset moves `latest` only when a release ships.
|
|
88
|
+
- **On GitLab:** the same kinds of machinery in `.gitlab-ci.yml` and the local files it includes: jobs that run on tags (`$CI_COMMIT_TAG`), `glab release create`, the `release:` keyword, `npm publish`, Docker pushes of `latest` from branch pushes. Remote, project and template includes aren't scanned: read them yourself. For a tag job that something else starts too (`- when: manual` for a trial build, a branch rule), `disable` removes only its tag rule; a job that only other removed jobs need can go with them (its decision is only offered while those are disabled). A note says when `workflow: rules` let tag pipelines run: launchset's own tags start none (it pushes them with `-o ci.skip`), but explain that other tag pushes still do, and that the rule may only have served the release jobs being retired.
|
|
89
|
+
- **Release instructions** in `CLAUDE.md`, `AGENTS.md` and the README (`npm version`, `git tag`, `changeset`): they describe the old process.
|
|
90
|
+
|
|
91
|
+
For each, propose `disable` (remove only the conflicting trigger or step, never the file), `remove` (delete the file or script) or `keep`, and why. Do it only after the human agrees. Where `disable` isn't offered, no minimal edit exists: the choice is `keep` or `remove`.
|
|
92
|
+
|
|
93
|
+
Also check, by reading the repo:
|
|
94
|
+
|
|
95
|
+
- **Long-lived Changesets pre-mode branches** (`.changeset/pre.json` on a branch): propose a prerelease branch entry (`preview.branches: [{ branch: "next", prerelease: "beta" }]`) and, on that branch, `npx launchset init --convert-only`. `pre.json` is ignored with a warning.
|
|
96
|
+
- **Deploy manifests that pin an image tag** (`imagePins[]`): ask per file. `image.<path>=stamp` makes the release PR update it to each release. `leave` keeps it as deploy state that is promoted by hand (for example a production overlay).
|
|
97
|
+
- **Docker image names and tags**: keep what deploy tooling pulls (`v{version}`).
|
|
98
|
+
|
|
99
|
+
## Step 4: Native store pipelines
|
|
100
|
+
|
|
101
|
+
Signing certificates, provisioning profiles, the Google Play upload key, the App Store Connect API key, the Play service account and the GitHub secrets are set up by a **human**. Guide them step by step with the docs pages "Setting up native store pipelines" (Apple and Google Play). Check each step without seeing a secret:
|
|
102
|
+
|
|
103
|
+
- Secret **names** exist: `gh secret list --repo <owner/repo>` (and `--org <org>`). Variables: `gh variable list --repo <owner/repo>` (and `--org <org>`).
|
|
104
|
+
- The workflow uses the same names: `grep -n "secrets\." .github/workflows/launchset-*.yml`.
|
|
105
|
+
- The config has `verify: ["store"]` with `store.packageName` or `store.appId`.
|
|
106
|
+
- A **preview build** passes: label a PR with `launchset:preview`, and read the PR comment and the job logs. A failing `verify` step prints what is wrong.
|
|
107
|
+
|
|
108
|
+
Never ask for, read or store a key, password, certificate, token or service account file. If one is pasted into the chat, tell the human to rotate it.
|
|
109
|
+
|
|
110
|
+
The **GitHub App** (the variable `LAUNCHSET_APP_CLIENT_ID` and the secret `LAUNCHSET_APP_PRIVATE_KEY`; older setups have the secret `LAUNCHSET_APP_ID` instead of the variable, which the workflows still accept) is also created by a human, an org owner. Point to the docs page "GitHub App setup". Permissions: Contents (read & write), Pull requests (read & write), Workflows (read & write), Actions (read), Metadata (read).
|
|
111
|
+
|
|
112
|
+
**On GitLab** a human creates a project or group access token (role Maintainer, scopes `api` and `write_repository`) and stores it as the masked, **not Protected** CI/CD variable `LAUNCHSET_TOKEN`, plus `NPM_TOKEN` (masked) for the private package. Point to the docs page "Token and permissions" (GitLab). You check variable names (`glab variable list` or the Settings page), never values. Protected branches and tags must let the token's bot push; "Minimum role to use pipeline variables" must allow manual runs.
|
|
113
|
+
|
|
114
|
+
## Step 5: Run init with the answers
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
npx launchset init --yes \
|
|
118
|
+
--decide version=1.4.0 \
|
|
119
|
+
--decide target.android=manual \
|
|
120
|
+
--decide docker.api.tags='v{version}, v{major}.{minor}, v{major}, latest' \
|
|
121
|
+
--decide 'machinery..github/workflows/release.yml#1=disable'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- `--yes` accepts the default of every decision you don't give. Never leave a conflict in place silently: give an answer for each.
|
|
125
|
+
- Quote values that have spaces or braces. An invalid value fails before anything is written (`expected one of ...`). An unknown id lists the valid ones.
|
|
126
|
+
- `--baseline`, `--skill` and `--hook` (and the `--no-` forms) are shortcuts for the three yes/no decisions.
|
|
127
|
+
|
|
128
|
+
Then look at the result: `git status`, `git diff`. Init writes (files that already exist are kept unless `file.<path>=overwrite`) `launchset.config.ts`, `.launchset/README.md`, `.github/workflows/launchset-check.yml`, `launchset-release.yml` and `launchset-preview.yml` (on GitLab instead `.gitlab/launchset.yml`, `.gitlab/launchset-targets.yml`, `.gitlab/ci-templates.yml` when templates moved, and a `.gitlab-ci.yml`, or only `include:` entries added to yours; init doesn't edit your `workflow:` and prints the recommended `workflow: rules` as a manual step), `CHANGELOG.md` (only if missing), converted changesets (`.changeset/*.md` to `.launchset/`, the folder is left in place), and the agent skill and `AGENTS.md` section.
|
|
129
|
+
|
|
130
|
+
Run `npx launchset status`, `version --dry-run` and `plan` to see that the config loads and the files are consistent.
|
|
131
|
+
|
|
132
|
+
## Step 6: Move the team's build steps
|
|
133
|
+
|
|
134
|
+
The generated workflows have commented examples where the team's build steps go. Move the existing steps from the old workflows, keeping secrets and environments as they are:
|
|
135
|
+
|
|
136
|
+
- Docker: the `docker/build-push-action` settings (`context`, `file`, `platforms`, build args). The tags and labels come from `steps.stamp.outputs.docker-tags` and `docker-labels`.
|
|
137
|
+
- Android and iOS: Gradle or `xcodebuild`, signing, fastlane. iOS runs on macOS.
|
|
138
|
+
- Deploys, npm publishing and other steps.
|
|
139
|
+
- Give every step `if: matrix.target == '<name>' && steps.verify.outputs.already-published != 'true'` in the release workflow.
|
|
140
|
+
- Custom targets from a GitHub workflow that release tags started: init already copied that job's steps, commented out, under the target's `Build steps missing` step in `launchset-release.yml` (and `launchset-preview.yml`), each with the `if:`. The `actions/checkout` step is left out: launchset's checks out the release commit, so add what the old one set (`lfs: true`, the note says) to it. Uncomment the steps, check them, then remove the guard. Previews run them too.
|
|
141
|
+
|
|
142
|
+
### Check the action versions
|
|
143
|
+
|
|
144
|
+
Do this for every `uses:` in the workflows the PR adds or changes: the steps init generated, the team's steps you moved, and anything you added. The generated pins were current when the launchset version you ran was released, which may be months ago. The team's pins are often older. Your own memory is older still.
|
|
145
|
+
|
|
146
|
+
1. **Find the latest release** of each action:
|
|
147
|
+
```sh
|
|
148
|
+
gh api repos/<owner>/<repo>/releases/latest --jq .tag_name
|
|
149
|
+
```
|
|
150
|
+
A 404 means the action publishes tags only: `gh api repos/<owner>/<repo>/tags --jq '.[].name'`, or `git ls-remote --tags https://github.com/<owner>/<repo>` without `gh`. Compare majors (`v7` against `v7.1.0`). Pins to a SHA or branch are the team's choice: leave them.
|
|
151
|
+
2. **Check compatibility before you bump.** For each major between the pin and the latest, read the release notes (`gh api repos/<owner>/<repo>/releases/tags/<tag> --jq .body`, or the action's CHANGELOG), and look for:
|
|
152
|
+
- **Inputs.** Every input the step passes must still exist and mean the same thing. Read `action.yml` at the new tag (`gh api 'repos/<owner>/<repo>/contents/action.yml?ref=<tag>' --jq .content | base64 -d`), and look for removed, renamed or `deprecationMessage` inputs and changed defaults.
|
|
153
|
+
- **Outputs** that later steps read (`steps.<id>.outputs.*`).
|
|
154
|
+
- **Behaviour** the workflow depends on: triggers it now refuses (for example `actions/checkout@v7` won't check out fork PRs under `pull_request_target` or `workflow_run`), where credentials are kept, caching, path layouts, and failures that used to be warnings.
|
|
155
|
+
- **Runner requirements**: the minimum runner version for self-hosted runners, and the Node runtime.
|
|
156
|
+
3. **Work out a recommendation per action.**
|
|
157
|
+
- Compatible: update.
|
|
158
|
+
- Needs a small edit: update and adapt the step (a renamed input, an output name).
|
|
159
|
+
- Needs something only the human can provide (a new secret or variable, a runner upgrade), or breaks a step: keep the working major for now, and say what the update would take.
|
|
160
|
+
|
|
161
|
+
Never make a step depend on a secret the repo may not have. For example, `actions/create-github-app-token@v3` deprecates `app-id` for `client-id`. The generated workflows pass `vars.LAUNCHSET_APP_CLIENT_ID || secrets.LAUNCHSET_APP_ID`, so an org with only the older secret keeps working.
|
|
162
|
+
4. **Apply it to launchset's own steps** (`stamp`, `verify`, `mark`, the token and checkout steps init generated): update the compatible ones without asking. They are launchset's, and the human approved launchset's workflows.
|
|
163
|
+
5. **Ask about the team's steps.** The steps you moved over are the team's, and so are the workflows the migration doesn't touch. Outdated pins there are common, often several majors behind. Don't update them silently, and don't leave them silently either. Ask the human once, in one question that lists every outdated action: where it is (`path:line`), the old and new major, what changes for that step, and your recommendation. For example:
|
|
164
|
+
|
|
165
|
+
> The build steps you moved use outdated actions. I recommend updating them in this PR:
|
|
166
|
+
> - `docker/build-push-action` v5 → v7 (`launchset-release.yml:142`): compatible, the inputs you use are unchanged.
|
|
167
|
+
> - `actions/setup-java` v3 → v6 (`launchset-release.yml:160`): compatible.
|
|
168
|
+
> - `ruby/setup-ruby` v1: current.
|
|
169
|
+
>
|
|
170
|
+
> `ci.yml` and `deploy.yml` (not part of the migration) also use `actions/checkout@v3` and `actions/setup-node@v3`; both are compatible. Shall I update those too, in a separate commit in this PR?
|
|
171
|
+
>
|
|
172
|
+
> Hold back: `some/action` v2 → v3 needs a new secret `X`.
|
|
173
|
+
|
|
174
|
+
Recommend updating everything that is compatible. Do what the human answers: update the steps they accept, in a separate commit so the review can tell the version updates apart from the migration, and leave the rest as it was.
|
|
175
|
+
6. **Report it.** In the PR description, list each action you checked: the old major, the new major and what you verified. Name the ones you held back and why, and the ones the human chose to keep.
|
|
176
|
+
|
|
177
|
+
To keep the pins current after the migration, suggest Dependabot for `github-actions`. init lists it as a manual step when the repo has no Dependabot or Renovate configuration. A Dependabot PR for a new major needs the same check: it bumps the version, not the inputs.
|
|
178
|
+
|
|
179
|
+
**On GitLab** the build steps go in `.gitlab/launchset-targets.yml`, in the hidden job `.launchset-<target>` of each target (init adds comments naming the old jobs that built each Docker image). Rules for those jobs: no `rules`, `when`, `needs` or `stage`; the image needs Node 24+, npm and git; one command per line (never `a && b`); no early `exit` (it would skip `mark`). `LAUNCHSET_VERSION`, `LAUNCHSET_BUILD_NUMBER`, `LAUNCHSET_CHANNEL`, `LAUNCHSET_DOCKER_TAGS` and `LAUNCHSET_DOCKER_LABELS` are set. There is no `if: matrix.target` guard to write: each target has its own job. Secrets are CI/CD variables.
|
|
180
|
+
|
|
181
|
+
For custom targets from tag jobs, init already copied the job's keys into `.launchset-<target>` (not `rules`, `needs`, `stage`; `$CI_COMMIT_TAG` became `$LAUNCHSET_TAG`), turned a `needs` between them into `after`, and moved the templates they extend to `.gitlab/ci-templates.yml`. Check with the human:
|
|
182
|
+
|
|
183
|
+
- **Node in the image.** launchset runs in every target job. Images like `ubuntu:22.04` or `nginx:alpine` lack Node 24+: add it to the job's `before_script` (careful: a `before_script` on the job replaces the one it extends) or to the template. On a PowerShell runner, Node, npm and git must be on the runner's PATH.
|
|
184
|
+
- **The version in files.** Add `files` to the target (`kind: "regex"` for `Cargo.toml`, `pyproject.toml`, lock files) so `stamp` writes the version in CI; init can't tell which files the build reads.
|
|
185
|
+
- **Previews.** Previews run the same steps with `LAUNCHSET_CHANNEL=preview`: publishing steps (an image tagged `latest`, an upload) must only run for `release`, or the target goes out of `preview.targets`.
|
|
186
|
+
- **After and retries.** A target with `after` gets the other targets' artifacts in the same pipeline only. On a retry that only rebuilds it they are missing: have the other targets also upload their output to a durable place (GitLab's generic package registry; the custom target template shows it) and fetch it from there.
|
|
187
|
+
|
|
188
|
+
**The "Build steps missing" guard.** For Android, iOS, web and custom targets without npm publishing, the generated workflows contain a step named `Build steps missing (<target>)` that always fails (`exit 1`), so `mark` never records a target that nothing builds. When the team's real build and upload steps for a target are in, **remove that target's guard step**, in both `launchset-release.yml` and `launchset-preview.yml` (on GitLab: the `echo "No build steps for <target> yet..."; exit 1` line in `.launchset-<target>`). Removing a guard without adding steps lets the release complete without building the target: check that every `auto` target has working steps before the PR is merged. Docker targets and npm custom targets have no guard.
|
|
189
|
+
|
|
190
|
+
## Step 7: Open one PR
|
|
191
|
+
|
|
192
|
+
Everything goes in **one PR**. Its description lists:
|
|
193
|
+
|
|
194
|
+
- The decisions and what was chosen (and why, for the ones the human decided).
|
|
195
|
+
- What was removed or disabled, with `path:line`.
|
|
196
|
+
- The action versions you checked, what you bumped and what you held back (see "Check the action versions").
|
|
197
|
+
- Changes to versions (files that moved to the canonical version) and any lowered version.
|
|
198
|
+
- The remaining manual steps: create the GitHub App and install it on the repo, add the variable `LAUNCHSET_APP_CLIENT_ID` and the secret `LAUNCHSET_APP_PRIVATE_KEY` (unless the org already has them, or the older secret `LAUNCHSET_APP_ID`; on GitLab: `LAUNCHSET_TOKEN` and `NPM_TOKEN`, protected branches and tags, pipeline variables, `workflow: rules` if init printed them), store credentials (`LAUNCHSET_PLAY_SERVICE_ACCOUNT_JSON`, `LAUNCHSET_ASC_KEY_ID`, `LAUNCHSET_ASC_ISSUER_ID`, `LAUNCHSET_ASC_PRIVATE_KEY`, keystore and signing secrets), and mark the **Changeset check** job as required once it runs (on GitLab: require the MR pipeline to succeed).
|
|
199
|
+
- That the PR itself needs a changeset: add one (`npx launchset add --bump patch --message "Set up releases with launchset"`, or `--empty`).
|
|
200
|
+
|
|
201
|
+
Don't merge it. Merging may start a release if the PR changed the root version of a version without a release tag.
|
|
202
|
+
|
|
203
|
+
## Repos that also publish npm packages
|
|
204
|
+
|
|
205
|
+
Some repos have something launchset should release (a Docker image, web or mobile apps) **and** npm packages that each have their own version, usually published with Changesets (public SDKs, a CLI, plugins). Don't stop, and don't put those packages on the one version: their version numbers would stop meaning anything to the people who install them. Propose the hybrid setup from the docs page "Alongside Changesets": launchset releases the one version and its targets, Changesets keeps versioning and publishing the npm packages. Each package is released by one tool, never both, so an npm package that Changesets publishes is never a launchset target.
|
|
206
|
+
|
|
207
|
+
Tell the human what this means and ask them to confirm. Then:
|
|
208
|
+
|
|
209
|
+
- **Version file.** Ask which `package.json` holds the one version: the workspace root (the default; Changesets never versions the root) or the app's own private package. For the second, set `version.file` and `changelog.file` in `launchset.config.ts` after init (for example `apps/app/package.json` and `apps/app/CHANGELOG.md`). `init` always writes the root.
|
|
210
|
+
- **Machinery.** Answer `keep` for every Changesets step and script that versions, checks or publishes the npm packages (`changesets/action`, `changeset version|status|publish`, pre-mode checks). Then edit those workflows by hand and move what launchset does now into `launchset-release.yml`: Docker build and push, deploys, tags and GitHub Releases for the app, steps that read the app version from a `package.json`. Other machinery (tag triggers, release scripts for the app) is handled as in Step 3.
|
|
211
|
+
- **Changesets config.** In `.changeset/config.json`, set `"privatePackages": { "version": false, "tag": false }`, so Changesets stops versioning and tagging the private app packages and `changeset status` only asks for a `.changeset` file when a public package changed.
|
|
212
|
+
- **Converted changesets.** `init` converts every pending `.changeset/*.md`. Delete the `.launchset/` copies of files that only named npm packages (or set them to `bump: none`), and check the bump of files that named the app. The originals stay in `.changeset/`. Don't follow init's hint to delete that folder.
|
|
213
|
+
- **The PR check.** Add `if: ${{ !startsWith(github.head_ref, 'changeset-release/') }}` to the `check` job in `launchset-check.yml`, so Changesets' Version Packages PR passes. A job `if`, not a `branches-ignore` filter: a skipped job counts as passed for a required check. Don't add `github-actions[bot]` to `check.bots`: every merged bot PR gets a `patch` entry and would release the app.
|
|
214
|
+
- **The PR description** says that Changesets stays for the npm packages, and how a PR that changes a package now needs both a `.changeset/` file and a `.launchset/` changeset.
|
|
215
|
+
|
|
216
|
+
## Out of scope: say why, don't migrate
|
|
217
|
+
|
|
218
|
+
- **Only independently versioned packages** (per-package npm releases in a workspace, like Changesets does), with nothing that shares one version: launchset has one version per repo. A repo with an app as well gets the hybrid setup above.
|
|
219
|
+
- **Build services outside GitHub Actions** (Xcode Cloud, Codemagic) and CI systems other than GitHub Actions and GitLab CI. Expo EAS is supported with `buildNumber: { strategy: "eas" }`.
|
|
220
|
+
- Repos with no shared version for their parts.
|
|
221
|
+
|
|
222
|
+
If the repo is out of scope, tell the human which of these applies and stop.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
@@job@@:
|
|
3
|
+
extends: @@extends@@
|
|
4
|
+
# A child pipeline has GitLab's default stages (not the parent's), so `test` always exists.
|
|
5
|
+
stage: test
|
|
6
|
+
needs:
|
|
7
|
+
# plan.json from the plan job of the parent pipeline.
|
|
8
|
+
- pipeline: $PARENT_PIPELINE_ID
|
|
9
|
+
job: @@plan_job@@
|
|
10
|
+
@@after_needs@@
|
|
11
|
+
interruptible: @@interruptible@@
|
|
12
|
+
variables:
|
|
13
|
+
LAUNCHSET_CLI: @@cli_spec@@
|
|
14
|
+
@@git_depth@@
|
|
15
|
+
@@shell_note@@
|
|
16
|
+
script:
|
|
17
|
+
@@script@@
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
# The launchset CLI (Node 24 or later with npm). An underscore in the name: target names can't
|
|
3
|
+
# have one, so it never clashes with a .launchset-<target> job.
|
|
4
|
+
.launchset_cli:
|
|
5
|
+
image: node:24
|
|
6
|
+
# A child pipeline has GitLab's default stages (not the parent's), so `test` always exists.
|
|
7
|
+
stage: test
|
|
8
|
+
variables:
|
|
9
|
+
# Full history and tags: finalize pushes the release tag and reads the history, and a
|
|
10
|
+
# prerelease's notes compare with the base branch.
|
|
11
|
+
GIT_DEPTH: "0"
|
|
12
|
+
LAUNCHSET_CLI: @@cli_spec@@
|
|
13
|
+
before_script:
|
|
14
|
+
@@install@@
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
launchset-preview-comment:
|
|
2
|
+
extends: .launchset_cli
|
|
3
|
+
# Also when a build failed, so the note shows which target failed. It runs in the child
|
|
4
|
+
# pipeline, which only exists once the plan job ran: a manual preview gets its note too.
|
|
5
|
+
when: always
|
|
6
|
+
interruptible: @@interruptible@@
|
|
7
|
+
needs:
|
|
8
|
+
- pipeline: $PARENT_PIPELINE_ID
|
|
9
|
+
job: @@plan_job@@
|
|
10
|
+
@@build_needs@@
|
|
11
|
+
script:
|
|
12
|
+
# One sticky MR note with the result per target (on a prerelease branch: the GitLab
|
|
13
|
+
# release; for a branch preview: this job's log).
|
|
14
|
+
- launchset preview-comment --plan @plan.json --ci
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
launchset-finalize:
|
|
3
|
+
extends: .launchset_cli
|
|
4
|
+
# Also when a build failed: finalize then records a partial release and reports which targets
|
|
5
|
+
# are missing. Creates the release tag and the GitLab release once every auto target shipped.
|
|
6
|
+
when: always
|
|
7
|
+
interruptible: false
|
|
8
|
+
needs:
|
|
9
|
+
- pipeline: $PARENT_PIPELINE_ID
|
|
10
|
+
job: @@plan_job@@
|
|
11
|
+
@@build_needs@@
|
|
12
|
+
script:
|
|
13
|
+
@@checkout@@
|
|
14
|
+
- launchset finalize --plan @plan.json --ci
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
# Generated by launchset @@version@@ for @@what@@.
|
|
2
|
+
# Don't edit: the @@plan_job@@ job writes this child pipeline in every pipeline (it is
|
|
3
|
+
# printed in that job's log and kept as its artifact). Your build steps live in
|
|
4
|
+
# @@targets_file@@, which launchset reads but never rewrites.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
# A child pipeline needs at least one job.
|
|
3
|
+
launchset-nothing-to-build:
|
|
4
|
+
image: busybox:1
|
|
5
|
+
# A child pipeline has GitLab's default stages (not the parent's), so `test` always exists.
|
|
6
|
+
stage: test
|
|
7
|
+
interruptible: true
|
|
8
|
+
variables:
|
|
9
|
+
GIT_STRATEGY: none
|
|
10
|
+
script:
|
|
11
|
+
- @@echo@@
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by launchset init. Safe to edit: launchset never rewrites this file.
|
|
2
|
+
#
|
|
3
|
+
# The project's CI configuration. launchset's jobs come from .gitlab/launchset.yml (included
|
|
4
|
+
# below) and your build steps per target from .gitlab/launchset-targets.yml. Add your own jobs
|
|
5
|
+
# (tests, linting) here.
|
|
6
|
+
@@sweep_note@@
|
|
7
|
+
|
|
8
|
+
workflow:
|
|
9
|
+
# On a new commit, cancel only jobs marked `interruptible: true` (checks, previews). launchset's
|
|
10
|
+
# release jobs are not, so the pipeline of a release commit is never cancelled before it
|
|
11
|
+
# published (the default "conservative" mode could cancel it while its release job waits).
|
|
12
|
+
auto_cancel:
|
|
13
|
+
on_new_commit: interruptible
|
|
14
|
+
# Merge request pipelines for branches with an open MR, branch pipelines otherwise, so a push
|
|
15
|
+
# never runs two pipelines. Run pipeline (web) and API pipelines always run.
|
|
16
|
+
rules:
|
|
17
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
18
|
+
@@always_branch_rules@@
|
|
19
|
+
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
|
|
20
|
+
when: never
|
|
21
|
+
- if: $CI_COMMIT_BRANCH
|
|
22
|
+
|
|
23
|
+
@@include@@
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
# Preview builds: test builds from an MR, a preview branch or a prerelease branch. Nothing is
|
|
3
|
+
# committed, no changesets are consumed and no marker or release tags are created. (Prerelease
|
|
4
|
+
# branches also get a git tag and a GitLab release.)
|
|
5
|
+
#
|
|
6
|
+
# Adding a label to an MR doesn't start a pipeline on GitLab. In MR pipelines the preview
|
|
7
|
+
# therefore runs:
|
|
8
|
+
@@preview_mr_help@@
|
|
9
|
+
# Fork MRs never get a preview: their pipelines have no access to this project's variables.
|
|
10
|
+
# The plan and trigger jobs share these conditions; only `when` differs.
|
|
11
|
+
#
|
|
12
|
+
# The result (one sticky MR note per preview, or the GitLab release of a prerelease) comes from
|
|
13
|
+
# the job launchset-preview-comment at the end of the child pipeline, so it also runs for a
|
|
14
|
+
# preview someone started from the manual job.
|
|
15
|
+
|
|
16
|
+
launchset-preview-plan:
|
|
17
|
+
extends: .launchset-cli
|
|
18
|
+
rules:
|
|
19
|
+
@@preview_plan_rules@@
|
|
20
|
+
# A newer push replaces the preview. Prerelease builds are never cancelled once they started
|
|
21
|
+
# (the child pipeline's jobs are not interruptible then).
|
|
22
|
+
interruptible: true
|
|
23
|
+
script:
|
|
24
|
+
# Decides the version, build number and targets (and reserves the tag on a prerelease
|
|
25
|
+
# branch). Writes plan.json (not when the preview is skipped) and launchset-child.yml.
|
|
26
|
+
- launchset preview-plan --ci
|
|
27
|
+
artifacts:
|
|
28
|
+
paths:
|
|
29
|
+
- plan.json
|
|
30
|
+
- launchset-child.yml
|
|
31
|
+
expire_in: 30 days
|
|
32
|
+
|
|
33
|
+
launchset-preview:
|
|
34
|
+
stage: @@stage@@
|
|
35
|
+
needs: [launchset-preview-plan]
|
|
36
|
+
rules:
|
|
37
|
+
@@preview_trigger_rules@@
|
|
38
|
+
variables:
|
|
39
|
+
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|
|
40
|
+
trigger:
|
|
41
|
+
include:
|
|
42
|
+
- artifact: launchset-child.yml
|
|
43
|
+
job: launchset-preview-plan
|
|
44
|
+
strategy: mirror
|
|
45
|
+
|
|
46
|
+
# Opt-in: start a preview when the label is added, without a push or a click. GitLab starts no
|
|
47
|
+
# pipeline for a label, so a pipeline schedule runs this job (Build > Pipeline schedules: the
|
|
48
|
+
# default branch, the variable LAUNCHSET_PREVIEW_SWEEP=true, for example every 10 minutes). It
|
|
49
|
+
# starts an MR pipeline for each open MR whose label was added after its last MR pipeline for
|
|
50
|
+
# the head commit: at most 10 per run, oldest label first. Without that schedule it never runs.
|
|
51
|
+
@@preview_sweep_help@@
|
|
52
|
+
launchset-preview-sweep:
|
|
53
|
+
extends: .launchset-cli
|
|
54
|
+
rules:
|
|
55
|
+
- if: $CI_PIPELINE_SOURCE == "schedule" && $LAUNCHSET_PREVIEW_SWEEP == "true"
|
|
56
|
+
variables:
|
|
57
|
+
# It reads only the config and the API: no history needed.
|
|
58
|
+
GIT_DEPTH: "1"
|
|
59
|
+
# The next scheduled run does the same work.
|
|
60
|
+
interruptible: true
|
|
61
|
+
script:
|
|
62
|
+
- launchset preview-sweep
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Your build and upload steps, one hidden job per launchset target. This file is yours: launchset
|
|
2
|
+
# reads it but never rewrites it; edit the build steps here.
|
|
3
|
+
#
|
|
4
|
+
# launchset's child pipeline (launchset-child.yml, generated by the launchset-release and
|
|
5
|
+
# launchset-preview-plan jobs) includes this file and runs one job per target that the plan
|
|
6
|
+
# builds. For a target `web`:
|
|
7
|
+
#
|
|
8
|
+
# build-web: # a release (preview-web for a preview)
|
|
9
|
+
# extends: .launchset-web # image, services, tags, variables and before_script from here
|
|
10
|
+
# script:
|
|
11
|
+
# - (install launchset)
|
|
12
|
+
# - launchset stamp ... # writes the version into the target's files, exports
|
|
13
|
+
# # LAUNCHSET_VERSION, LAUNCHSET_BUILD_NUMBER, LAUNCHSET_CHANNEL, ...
|
|
14
|
+
# - launchset verify ... # releases: already published? then only `mark` runs
|
|
15
|
+
# - !reference [.launchset-web, script] # YOUR steps below
|
|
16
|
+
# - launchset mark ... # releases: records that the target shipped
|
|
17
|
+
#
|
|
18
|
+
# Rules for these jobs:
|
|
19
|
+
# - No `rules`, `when`, `needs` or `stage`: the child pipeline decides when a job runs. (A child
|
|
20
|
+
# pipeline whose jobs are all ruled out fails to start.) The plan job warns when a job, or a
|
|
21
|
+
# template it extends, sets one of them.
|
|
22
|
+
# - A target that needs another target's output: set "after" on it in launchset.config, e.g.
|
|
23
|
+
# "after": ["windows", "appimage"]. Its job then waits for theirs and gets their artifacts.
|
|
24
|
+
# On a retry that only builds the waiting target, the others' artifacts (from the earlier
|
|
25
|
+
# pipeline) aren't there: upload what other targets need somewhere durable (see the custom
|
|
26
|
+
# target example), and fetch it from there.
|
|
27
|
+
# - Every job runs launchset, so its image needs Node 24 or later, npm and git (the
|
|
28
|
+
# before_script below installs them where the image lacks them). On a Windows runner with
|
|
29
|
+
# PowerShell (gitlab.shell: "powershell" on the target), Node 24 or later, npm and git must be
|
|
30
|
+
# on the runner's PATH; launchset's lines of the job are then PowerShell.
|
|
31
|
+
# - `before_script` runs first, then launchset's lines and your `script`, all in one shell.
|
|
32
|
+
# launchset's lines change to $CI_PROJECT_DIR first, so your steps may change directory.
|
|
33
|
+
# - Put one command per line, and never `exit` early: GitLab runs the lines in one shell with
|
|
34
|
+
# `set -e`, which ignores a failure on the left of `&&`, and an `exit` would skip `mark`.
|
|
35
|
+
# - A job may extend hidden templates (`extends: .windows`) from files listed in gitlab.include
|
|
36
|
+
# in launchset.config (e.g. .gitlab/ci-templates.yml): the child pipeline includes them. Those
|
|
37
|
+
# files may only hold hidden jobs, variables and default. Templates in .gitlab-ci.yml itself
|
|
38
|
+
# aren't there: the child pipeline can't include it (it would run every job in it).
|
|
39
|
+
# - The variables from `stamp` are set: LAUNCHSET_VERSION (plain X.Y.Z for iOS),
|
|
40
|
+
# LAUNCHSET_BUILD_NUMBER, LAUNCHSET_CHANNEL (`release`, `prerelease` or `preview`: pick the
|
|
41
|
+
# upload channel with it; previews go to internal channels only), LAUNCHSET_DIST_TAG,
|
|
42
|
+
# LAUNCHSET_DOCKER_TAGS and LAUNCHSET_DOCKER_LABELS (one per line), LAUNCHSET_TAG.
|
|
43
|
+
# - Secrets are CI/CD variables (Settings > CI/CD > Variables), referenced by name only.
|
|
44
|
+
@@jobs@@
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Generated by launchset init. Safe to edit: launchset never rewrites this file.
|
|
2
|
+
#
|
|
3
|
+
# launchset's GitLab CI jobs. Your .gitlab-ci.yml includes this file:
|
|
4
|
+
#
|
|
5
|
+
# include:
|
|
6
|
+
# - local: .gitlab/launchset.yml
|
|
7
|
+
#
|
|
8
|
+
# launchset-check MR pipelines: every MR needs a changeset (or `bump: none`), unless
|
|
9
|
+
# it comes from a bot or is the release MR. One sticky MR note.
|
|
10
|
+
# launchset-release pushes to the base branch (or a maintenance branch): updates the
|
|
11
|
+
# release MR or, when the release MR was just merged, plans the
|
|
12
|
+
# release and writes the child pipeline launchset-child.yml
|
|
13
|
+
# launchset-build runs launchset-child.yml: one build-<target> job per target
|
|
14
|
+
# (stamp -> verify -> YOUR build and upload steps -> mark), then
|
|
15
|
+
# launchset-finalize (release tag and GitLab release)
|
|
16
|
+
@@preview_overview@@
|
|
17
|
+
#
|
|
18
|
+
# Your build and upload steps live in .gitlab/launchset-targets.yml (one hidden job per target).
|
|
19
|
+
# The child pipeline only contains the jobs a plan needs: nothing to build, no build jobs.
|
|
20
|
+
#
|
|
21
|
+
# Requirements:
|
|
22
|
+
# - GitLab 18.2 or later (trigger:strategy:mirror).
|
|
23
|
+
# - Merge request pipelines (see the workflow: rules launchset init writes into .gitlab-ci.yml).
|
|
24
|
+
# - The CI/CD variable LAUNCHSET_TOKEN: a project or group access token with the api and
|
|
25
|
+
# write_repository scopes and the Maintainer role, masked. Pushes made with CI_JOB_TOKEN never
|
|
26
|
+
# start pipelines, so the release MR would get none. If you mark it Protected, only pipelines
|
|
27
|
+
# of protected branches get it: MR checks then can't post their note, and MR previews can't
|
|
28
|
+
# comment.
|
|
29
|
+
# Fork MR pipelines that run in the fork have none of this project's variables, so
|
|
30
|
+
# launchset-check can't post its note there and skips them (run the MR's pipeline in this
|
|
31
|
+
# project, from the MR's Pipelines tab, to check it).
|
|
32
|
+
# - Runners for the node:24 image. launchset needs Node 24 or later, npm and git.
|
|
33
|
+
#
|
|
34
|
+
# Starting a pipeline by hand (Build > Pipelines > Run pipeline), with pipeline variables:
|
|
35
|
+
# - On the base branch or a maintenance branch, without variables: retries an unfinished
|
|
36
|
+
# release of the current version (for example when its pipeline was cancelled or failed).
|
|
37
|
+
# - LAUNCHSET_TARGET=<name>: ships a manual target (for example an iOS app that is not built on
|
|
38
|
+
# every release). LAUNCHSET_RELEASE_VERSION=<version> picks the released version (default:
|
|
39
|
+
# the latest release on this branch); LAUNCHSET_FORCE=true ships it even if the target
|
|
40
|
+
# already shipped a higher version. LAUNCHSET_ATTEMPT=<1-99> sets the last two digits of a
|
|
41
|
+
# "semver" build number (default 1), to upload the same version again.
|
|
42
|
+
@@preview_manual_help@@
|
|
43
|
+
# GitLab may restrict pipeline variables by role: Settings > CI/CD > Variables, "Minimum role
|
|
44
|
+
# to use pipeline variables" (default Maintainer on self-managed; no_one_allowed for new
|
|
45
|
+
# projects on GitLab.com, which blocks the runs above until you change it).
|
|
46
|
+
|
|
47
|
+
# The launchset CLI for every launchset job.
|
|
48
|
+
.launchset-cli:
|
|
49
|
+
# Node 24 or later with npm (node:24 is Debian, with git). launchset installs into it with npm.
|
|
50
|
+
image: node:24
|
|
51
|
+
stage: @@stage@@
|
|
52
|
+
variables:
|
|
53
|
+
# Full history and tags: launchset compares with the last release and pushes tags.
|
|
54
|
+
GIT_DEPTH: "0"
|
|
55
|
+
# The launchset package to install. A CI/CD variable of the same name overrides it.
|
|
56
|
+
LAUNCHSET_CLI: @@cli_spec@@
|
|
57
|
+
# No cache: launchset needs none, and files a `default: cache` restores into the checkout
|
|
58
|
+
# would count as uncommitted changes when launchset builds the release branch.
|
|
59
|
+
cache: []
|
|
60
|
+
before_script:
|
|
61
|
+
@@install@@
|
|
62
|
+
|
|
63
|
+
# The pipelines that release: pushes, and Run pipeline (web) or the API on the base branch and the
|
|
64
|
+
# maintenance branches. Not a manual preview (LAUNCHSET_PREVIEW=true).
|
|
65
|
+
.launchset-release-rules:
|
|
66
|
+
rules:
|
|
67
|
+
- if: $LAUNCHSET_PREVIEW == "true"
|
|
68
|
+
when: never
|
|
69
|
+
- if: $CI_PIPELINE_SOURCE != "push" && $CI_PIPELINE_SOURCE != "web" && $CI_PIPELINE_SOURCE != "api"
|
|
70
|
+
when: never
|
|
71
|
+
@@release_branch_rules@@
|
|
72
|
+
|
|
73
|
+
launchset-check:
|
|
74
|
+
extends: .launchset-cli
|
|
75
|
+
# A newer push to the MR makes this run redundant.
|
|
76
|
+
interruptible: true
|
|
77
|
+
rules:
|
|
78
|
+
- if: $CI_PIPELINE_SOURCE != "merge_request_event"
|
|
79
|
+
when: never
|
|
80
|
+
# Not in a fork MR's pipeline that runs in the fork: it has no LAUNCHSET_TOKEN.
|
|
81
|
+
- if: $CI_PROJECT_ID != $CI_MERGE_REQUEST_PROJECT_ID
|
|
82
|
+
when: never
|
|
83
|
+
# MRs into the base branch, the maintenance branches (hotfixes) and the prerelease branches.
|
|
84
|
+
@@check_rules@@
|
|
85
|
+
script:
|
|
86
|
+
- launchset check
|
|
87
|
+
|
|
88
|
+
launchset-release:
|
|
89
|
+
extends: .launchset-cli
|
|
90
|
+
rules: !reference [.launchset-release-rules, rules]
|
|
91
|
+
# One release job per branch at a time, so release MR updates happen one after the other.
|
|
92
|
+
# GitLab keeps every job that waits for a resource group (it never drops one), so the pipeline
|
|
93
|
+
# of the release commit always gets its publish run. (The order isn't guaranteed: a job for an
|
|
94
|
+
# older commit may run after a newer one; launchset then leaves the release MR to the newest.)
|
|
95
|
+
resource_group: launchset-release-$CI_COMMIT_REF_SLUG
|
|
96
|
+
# Never cancelled once it started. The release commit's push is the only run that publishes
|
|
97
|
+
# it (pushes don't retry a release), but GitLab's "Auto-cancel redundant pipelines" can still
|
|
98
|
+
# cancel its pipeline while this job waits, when another push follows quickly. The
|
|
99
|
+
# `workflow: auto_cancel: on_new_commit: interruptible` that launchset init writes into
|
|
100
|
+
# .gitlab-ci.yml prevents that. If it happened anyway: Run pipeline on the branch without
|
|
101
|
+
# variables retries the unfinished release.
|
|
102
|
+
interruptible: false
|
|
103
|
+
# No artifacts from jobs of earlier stages: in the checkout they would count as uncommitted
|
|
104
|
+
# changes when launchset builds the release branch.
|
|
105
|
+
dependencies: []
|
|
106
|
+
script:
|
|
107
|
+
# Writes plan.json, launchset.env (below), launchset.sh and launchset-child.yml, the child
|
|
108
|
+
# pipeline for the plan (printed to this log too).
|
|
109
|
+
- launchset release --ci
|
|
110
|
+
artifacts:
|
|
111
|
+
paths:
|
|
112
|
+
- plan.json
|
|
113
|
+
- launchset-child.yml
|
|
114
|
+
reports:
|
|
115
|
+
# LAUNCHSET_MODE, LAUNCHSET_VERSION, LAUNCHSET_TAG, ... for later jobs that need this one.
|
|
116
|
+
dotenv: launchset.env
|
|
117
|
+
# Long enough to retry a failed build job of the child pipeline: it reads plan.json from here.
|
|
118
|
+
expire_in: 30 days
|
|
119
|
+
|
|
120
|
+
launchset-build:
|
|
121
|
+
stage: @@stage@@
|
|
122
|
+
needs: [launchset-release]
|
|
123
|
+
rules: !reference [.launchset-release-rules, rules]
|
|
124
|
+
variables:
|
|
125
|
+
# The child jobs read plan.json from launchset-release in this pipeline.
|
|
126
|
+
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|
|
127
|
+
trigger:
|
|
128
|
+
include:
|
|
129
|
+
- artifact: launchset-child.yml
|
|
130
|
+
job: launchset-release
|
|
131
|
+
# This job (and so this pipeline and the MR) gets the child pipeline's status.
|
|
132
|
+
strategy: mirror
|
|
133
|
+
@@preview_jobs@@
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
# --- @@target@@ (android): example steps, uncomment and adapt ---
|
|
3
|
+
.launchset-@@target@@:
|
|
4
|
+
# An image with the Android SDK, Java and Node (CircleCI's Android image, the `-node` variant
|
|
5
|
+
# has the current Node LTS). Any image with the SDK, Java and Node 24 or later works: change
|
|
6
|
+
# the tag to pin another release (https://hub.docker.com/r/cimg/android/tags).
|
|
7
|
+
image: cimg/android:@@android_image_tag@@
|
|
8
|
+
@@verify_variables@@
|
|
9
|
+
before_script:
|
|
10
|
+
# The image runs as a non-root user: global npm packages (launchset) go to the home folder.
|
|
11
|
+
- export NPM_CONFIG_PREFIX="$HOME/.npm-global" PATH="$HOME/.npm-global/bin:$PATH"
|
|
12
|
+
script:
|
|
13
|
+
# Remove this line once you've added the build and upload steps below: it stops the release
|
|
14
|
+
# from marking @@target@@ as shipped while nothing builds it.
|
|
15
|
+
- echo "No build steps for @@target@@ yet. Add them to .gitlab/launchset-targets.yml and remove this line."; exit 1
|
|
16
|
+
# `stamp` already wrote versionName and versionCode into the Gradle files. LAUNCHSET_CHANNEL
|
|
17
|
+
# picks the Google Play track: release -> production, prerelease -> beta, preview -> internal.
|
|
18
|
+
# Signing secrets (ANDROID_KEYSTORE_BASE64, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS,
|
|
19
|
+
# ANDROID_KEY_PASSWORD) are CI/CD variables your Gradle config reads.
|
|
20
|
+
#
|
|
21
|
+
# - cd @@android_dir@@
|
|
22
|
+
# - ./gradlew bundleRelease
|
|
23
|
+
# - case "$LAUNCHSET_CHANNEL" in release) PLAY_TRACK=production ;; prerelease) PLAY_TRACK=beta ;; *) PLAY_TRACK=internal ;; esac
|
|
24
|
+
# - export SUPPLY_JSON_KEY_DATA="$LAUNCHSET_PLAY_SERVICE_ACCOUNT_JSON"
|
|
25
|
+
# - bundle exec fastlane supply --aab app/build/outputs/bundle/release/app-release.aab --track "$PLAY_TRACK" --package_name "@@package_name@@"
|