Skip to content

Commit

Permalink
Re-introduce automated Typescript NPM release
Browse files Browse the repository at this point in the history
This is in addition to the Scala Maven release provided by the previous
commit. This change is only separated out from the previous commit to
show how the 'standard' release.yml has been modified for this dual
Scala & Typescript release workflow.

Note that #229 already
did a lot of the work involved in getting automated NPM releases going,
this is just a refactoring to work better with the
gha-scala-library-release-workflow.
  • Loading branch information
rtyley committed Jan 24, 2024
1 parent bc54a10 commit 46a290c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,32 @@ on:
workflow_dispatch:

jobs:
release:
scala-maven-release:
name: Maven Release
uses: guardian/gha-scala-library-release-workflow/.github/workflows/reusable-release.yml@main
permissions: { contents: write, pull-requests: write }
secrets:
SONATYPE_PASSWORD: ${{ secrets.AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD }}
PGP_PRIVATE_KEY: ${{ secrets.AUTOMATED_MAVEN_RELEASE_PGP_SECRET }}

typescript-npm-release:
name: NPM Release
needs: scala-maven-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 11
cache: sbt
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org
- name: Release Typescript to NPM
run: |
sbt "project typescript" "releaseNpm ${{ needs.scala-maven-release.outputs.RELEASE_VERSION }}"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
RELEASE_TYPE: ${{ needs.scala-maven-release.outputs.RELEASE_TYPE }}
5 changes: 5 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,14 @@ lazy val benchmarks = Project(id = "benchmarks", base = file("benchmarks"))
publishArtifact := false
)

lazy val npmPreviewReleaseTagMaybe = if (sys.env.get("RELEASE_TYPE").contains("PREVIEW_FEATURE_BRANCH")) {
Seq(scroogeTypescriptPublishTag := "preview")
} else Seq.empty

lazy val typescript = (project in file("ts"))
.enablePlugins(ScroogeTypescriptGen)
.settings(artifactProductionSettings)
.settings(npmPreviewReleaseTagMaybe)
.settings(
name := "content-api-models-typescript",
scroogeTypescriptNpmPackageName := "@guardian/content-api-models",
Expand Down

0 comments on commit 46a290c

Please sign in to comment.