Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/manual-publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
workflow_dispatch:
inputs:
workspace_path:
description: 'The workspace to publish docs for'
required: true
default: 'packages/shared/common'
type: choice
options:
- packages/shared/common
- packages/shared/sdk-server
- packages/sdk/server-node
name: Publish Documentation
jobs:
build-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: 'Set WORKSPACE_NAME variable'
run: |
WORKSPACE_NAME=$(./scripts/package-name.sh ${{ inputs.workspace_path }})
echo "WORKSPACE_NAME=$WORKSPACE_NAME" >> $GITHUB_ENV
- id: build
# Build using the same steps from CI.
name: Build and Test
uses: ./actions/ci
with:
workspace_name: ${{ env.WORKSPACE_NAME }}
workspace_path: ${{ inputs.workspace_path }}
- id: publish
name: Publish Documentation
uses: ./actions/publish-docs
with:
workspace_path: ${{ inputs.workspace_path }}
53 changes: 53 additions & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish Package
on:
workflow_dispatch:
inputs:
workspace_path:
description: 'The workspace to publish'
required: true
default: 'packages/shared/common'
type: choice
options:
- packages/shared/common
- packages/shared/sdk-server
- packages/sdk/server-node
prerelease:
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
type: boolean
required: true
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true

jobs:
build-publish:
runs-on: ubuntu-latest
# Needed to get tokens during publishing.
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- name: 'Set WORKSPACE_NAME variable'
run: |
WORKSPACE_NAME=$(./scripts/package-name.sh ${{ inputs.workspace_path }})
echo "WORKSPACE_NAME=$WORKSPACE_NAME" >> $GITHUB_ENV
- id: build-and-test
# Build using the same steps from CI.
name: Build and Test
uses: ./actions/ci
with:
workspace_name: ${{ env.WORKSPACE_NAME }}
workspace_path: ${{ inputs.workspace_path }}
- id: publish
name: Publish Package
uses: ./actions/publish
with:
workspace_name: ${{ env.WORKSPACE_NAME }}
prerelease: ${{ inputs.prerelease }}
dry_run: ${{ inputs.dry_run }}
80 changes: 80 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
on:
push:
branches:
- main
name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
package-common-released: ${{ steps.release.outputs['packages/shared/common--release_created'] }}
package-sdk-server-released: ${{ steps.release.outputs['packages/shared/sdk-server--release_created'] }}
package-server-node-released: ${{ steps.release.outputs['packages/sdk/server-node--release_created'] }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
token: ${{secrets.GITHUB_TOKEN}}
default-branch: main

release-common:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write
contents: write
if: ${{ needs.release-please.outputs.package-common-released }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- id: release-common
name: Full release of packages/shared/common
uses: ./actions/full-release
with:
workspace_path: packages/shared/common
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}

release-sdk-server:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write
contents: write
if: ${{ needs.release-please.outputs.package-sdk-server-released }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- id: release-common
name: Full release of packages/shared/sdk-server
uses: ./actions/full-release
with:
workspace_path: packages/shared/sdk-server
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I am going to have to define the AWS_ROLE_ARN using terraform.


release-server-node:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write
contents: write
if: ${{ needs.release-please.outputs.package-sdk-server-released }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- id: release-common
name: Full release of packages/sdk/server-node
uses: ./actions/full-release
with:
workspace_path: packages/sdk/server-node
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
14 changes: 14 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v7
with:
stale-issue-message: 'This issue is stale because it has been open for 90 days without activity. Remove the stale label or comment, or this will be closed in 14 days.'
days-before-stale: 90
days-before-close: 14
Empty file added .release-please-manifest.json
Empty file.
4 changes: 2 additions & 2 deletions actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ inputs:
# Some commands work on the package name (yarn commands), other require the path (typedoc),
# so we supply both.
workspace_name:
description: 'Name, from the package.json, of the package to build/test.'
required: true
type: string
workspace_path:
description: 'Path to the package to release.'
required: true
type: string

runs:
using: composite
Expand Down
41 changes: 41 additions & 0 deletions actions/full-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build, Test, and Publish
description: 'Execute the full release process for a workspace.'
inputs:
workspace_path:
description: 'Path to the workspace being released.'
required: true
aws_assume_role:
description: 'The ARN of an AWS IAM role to assume. Used to auth with AWS to upload results to S3.'
required: true

runs:
using: composite
steps:
- name: 'Set WORKSPACE_NAME variable'
shell: bash
run: |
WORKSPACE_NAME=$(./scripts/package-name.sh ${{ inputs.workspace_path }})
echo "WORKSPACE_NAME=$WORKSPACE_NAME" >> $GITHUB_ENV
- uses: ./actions/ci
with:
workspace_name: ${{ env.WORKSPACE_NAME }}
workspace_path: ${{ inputs.workspace_path }}
- uses: ./actions/release-secrets
name: 'Get NPM token'
with:
aws_assume_role: ${{ inputs.aws_assume_role }}
ssm_parameter_pairs: '/production/common/releasing/npm/token = NODE_AUTH_TOKEN'
- name: Setup .yarnrc.yml
shell: bash
run: |
yarn config set npmScopes.launchdarkly.npmRegistryServer "https://registry.npmjs.org"
yarn config set npmScopes.launchdarkly.npmAlwaysAuth true
yarn config set npmScopes.launchdarkly.npmAuthToken $NODE_AUTH_TOKEN
- uses: ./actions/publish
with:
workspace_name: ${{ env.WORKSPACE_NAME }}
prerelease: false
dry_run: false
- uses: ./actions/publish-docs
with:
workspace_path: ${{ inputs.workspace_path }}
22 changes: 22 additions & 0 deletions actions/publish-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This action publishes docs. The docs must have been build prior.
name: Publish Docs
description: Publish documentation to github pages.
inputs:
workspace_path:
description: 'The workspace to publish docs for'
required: true
runs:
using: composite
steps:
# We put the github pages in another directory.
- uses: actions/checkout@v3
with:
path: gh-pages
ref: gh-pages
- name: Publish Docs
shell: bash
run: |
echo "Publishing docs for: $WORKSPACE"
./scripts/publish-doc.sh
env:
WORKSPACE: ${{ inputs.workspace_path }}
25 changes: 25 additions & 0 deletions actions/publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish to NPM
description: Publish a package from the workspace.
inputs:
workspace_name:
description: 'The workspace to publish'
required: true
prerelease:
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
required: true
dry_run:
description: 'Is this a dry run. If so no package will be published.'
required: true

runs:
using: composite
steps:
- name: Publish
shell: bash
run: |
echo "Publishing: $WORKSPACE"
./scripts/publish.sh
env:
WORKSPACE: ${{ inputs.workspace_name }}
LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }}
LD_RELEASE_IS_DRYRUN: ${{ inputs.dry_run }}
26 changes: 26 additions & 0 deletions actions/release-secrets/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release Secrets
# Currently this handles SSM, but once we need an s3 secret we should add support.
description: 'Action for getting release secrets from SSM'
inputs:
aws_assume_role:
description: 'The ARN of an AWS IAM role to assume. Used to auth with AWS to upload results to S3.'
required: true
# This uses this format to allow using the GetParameters action.
ssm_parameter_pairs:
description: 'A series of pairs of paths to environment mappings. "/path = ENV_NAME", "/path2 = ENV_NAME2'
required: false
# If we add S3, then just have a list of S3 paths.

runs:
using: composite
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
audience: https://github.com/launchdarkly
role-to-assume: ${{ inputs.aws_assume_role }}
aws-region: us-east-1
- uses: dkershner6/aws-ssm-getparameters-action@v1
with:
parameterPairs: ${{ inputs.ssm_parameter_pairs }}
withDecryption: 'true'
Empty file.
Empty file.
Empty file.
20 changes: 20 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"packages": {
"packages/shared/common": {
"prerelease": true,
"bump-minor-pre-major": true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are going to be pre-releases starting with 0.x.y until we are ready to really release.

"bootstrap-sha": "282a3fed8289fef680c5c2593e74aea0a3113c71"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may end up needing updated before the initial release, but it instructions release please to start at that SHA when calculating release notes. Which we do not want all the way back for the initial release.

},
"packages/shared/sdk-server": {
"prerelease": true,
"bump-minor-pre-major": true,
"bootstrap-sha": "282a3fed8289fef680c5c2593e74aea0a3113c71"
},
"packages/sdk/server-node": {
"prerelease": true,
"bump-minor-pre-major": true,
"bootstrap-sha": "282a3fed8289fef680c5c2593e74aea0a3113c71"
}
},
"plugins": ["node-workspace"]
}
5 changes: 4 additions & 1 deletion scripts/doc-name.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Given a path get the name for the documentation.
# ./scripts/doc-name.sh packages/sdk/node
# ./scripts/doc-name.sh packages/sdk/server-node
# Produces something like:
# LaunchDarkly Server-Side SDK for Node.js (0.1.0)

set -e

node -p "let pj = require('./$1/package.json');\`\${pj.description} (\${pj.version})\`";
8 changes: 8 additions & 0 deletions scripts/package-name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Given a path get the name of the package.
# ./scripts/package-name.sh packages/sdk/server-node
# Produces something like:
# @launchdarkly/node-server-sdk

set -e

node -p "require('./$1/package.json').name";
Loading