-
Notifications
You must be signed in to change notification settings - Fork 31
build: Add release-please configuration. #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a2ea517
f28b284
25f0893
f2bc904
a2f8219
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 }} |
| 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 }} |
| 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 }} | ||
|
|
||
| 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 }} | ||
| 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 |
| 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 }} |
| 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 }} |
| 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 }} |
| 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' |
| 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, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are going to be pre-releases starting with |
||
| "bootstrap-sha": "282a3fed8289fef680c5c2593e74aea0a3113c71" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"] | ||
| } | ||
| 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})\`"; |
| 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"; |
There was a problem hiding this comment.
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.