This project contains Thrift models and a way to publish them as Scala and TypeScript packages. MAPI uses the Scala package to send data to the Apps Rendering API, which uses the TypeScript package to deserialise the data. These two projects can be found here:
- MAPI (uses the Scala package): https://github.com/guardian/mobile-apps-api
- Apps-Rendering (uses the TypeScript package): https://github.com/guardian/dotcom-rendering/tree/main/apps-rendering
This repository uses changesets
to manage versions and releases.
To create a changeset, ensure you are using the correct Node (and associated npm) version defined in .nvmrc
and project dependencies installed by running npm install
. Then:
- Run
npx changeset
. Select the type of change and enter a description - Commit and push the changeset file to your branch
- When your feature PR is merged to
main
, the changesets action will open a PR againstmain
with the details of all unreleased changes. This is a "Release PR" - When ready to release, merge the Release PR
flowchart TD
Title([Releasing a new version])
Title ~~~ AddChangeset
AddChangeset[Add changeset to your branch]
GHBranchActions[Create and merge PR]
GHA[GitHub Actions]
ReleasePR[Release PR]
GHA2[GitHub Actions]
ReleaseNPM[Release to NPM]
ReleaseSonatype[Release to Sonatype]
AddChangeset-->GHBranchActions-.triggers.->GHA-.opens.->ReleasePR--merge-->GHA2
GHA2-.->ReleaseNPM
GHA2-.->ReleaseSonatype
- Push the branch with the changes you want to test to GitHub
- Click here to create a Prerelease using GitHub Releases
- Set the Target to your branch
- You must also create a tag for the snapshot release. Use the following format:
v0.0.0-YYYY-MM-DD-SNAPSHOT
. For example,v0.0.0-2022-10-20-SNAPSHOT
. It is important the tag begins withv
and ends with-SNAPSHOT
. - Make sure the "Set as pre-release" box is ticked:
- To automatically release the snapshot to
npm
andsonatype
, publish the prerelease - Snapshots are released to the
snapshot
tag onnpm
. You can install them withnpm install @guardian/apps-rendering-api-models@snapshot
flowchart TD
Title([Releasing a Snapshot])
Title ~~~ PushBranch
PushBranch[Push branch]
CreatePrerelease[Create & Publish a prerelease in GitHub]
Info>Tag must end in '-SNAPSHOT']
PushBranch -- then --> CreatePrerelease
Info -.-> CreatePrerelease
GHA[GitHub Action]
CreatePrerelease -. triggers .-> GHA
Sonatype[Publish to Sonatype]
NPM[Publish to NPM]
GHA-.->Sonatype
GHA-.->NPM
If you run sbt test
it will fail, you can only run sbt compile
to check that it's working correctly. This project doesn't have tests because it's used to auto-generate Scala and TypeScript packages from Thrift definitions, there's no Scala or TS source code.