Skip to content
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

chore: add release-please automation #659

Merged
merged 11 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from 9 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
106 changes: 0 additions & 106 deletions .github/workflows/publish.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
push:
branches:
- main

name: Run Release Please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v2
id: release
with:
command: manifest
token: ${{secrets.RELEASE_PR_TOKEN}}
dyladan marked this conversation as resolved.
Show resolved Hide resolved
default-branch: main

# The logic below handles the npm publication:
- name: Checkout Repository
if: ${{ steps.release.outputs.releases_created }}
Copy link
Member

Choose a reason for hiding this comment

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

Is releases meant to be plural? I might be misremembering but i thought it was singular.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I believe their README is incorrect. I submitted a PR to correct it: googleapis/release-please#1057

Based on my output from this test run it's plural: https://github.com/willarmiros/test-package-lock-repo/runs/3617992025?check_suite_focus=true#step:3:4

uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v1
if: ${{ steps.release.outputs.releases_created }}
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'

- name: Cache Dependencies
if: ${{ steps.release.outputs.releases_created }}
uses: actions/cache@v2
with:
path: |
node_modules
package-lock.json
detectors/node/*/node_modules
metapackages/*/node_modules
packages/*/node_modules
plugins/node/*/node_modules
plugins/web/*/node_modules
propagators/*/node_modules
key: ${{ runner.os }}-${{ matrix.container }}-${{ hashFiles('**/package.json') }}
willarmiros marked this conversation as resolved.
Show resolved Hide resolved

- name: Build Packages
if: ${{ steps.release.outputs.releases_created }}
run: |
npm install
npx lerna bootstrap --no-ci

# Release Please has already incremented versions and published tags, so we just
# need to publish all unpublished versions to NPM here
# See: https://github.com/lerna/lerna/tree/main/commands/publish#bump-from-package
- name: Publish to NPM
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: npx lerna publish from-package --no-push --no-git-tag-version --no-verify-access --yes
willarmiros marked this conversation as resolved.
Show resolved Hide resolved
63 changes: 0 additions & 63 deletions .github/workflows/release-pr.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ package.json.lerna_backup

*.iml
.idea

# version.ts file is automatically generated at compile time
version.ts
42 changes: 42 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"detectors/node/opentelemetry-resource-detector-alibaba-cloud": "0.25.0",
"detectors/node/opentelemetry-resource-detector-aws": "0.25.0",
"detectors/node/opentelemetry-resource-detector-gcp": "0.25.0",
"detectors/node/opentelemetry-resource-detector-github": "0.25.0",
"metapackages/auto-instrumentations-node": "0.25.0",
"metapackages/auto-instrumentations-web": "0.25.0",
"packages/opentelemetry-browser-extension-autoinjection": "0.25.0",
Copy link
Member

Choose a reason for hiding this comment

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

The manifest will be regenerated anyway on the next release so having extra entries is actually not a problem. Missing entries would be a bigger deal.

"packages/opentelemetry-host-metrics": "0.25.0",
"packages/opentelemetry-id-generator-aws-xray": "0.25.0",
"packages/opentelemetry-test-utils": "0.25.0",
"plugins/node/opentelemetry-instrumentation-aws-lambda": "0.25.0",
"plugins/node/opentelemetry-instrumentation-bunyan": "0.25.0",
"plugins/node/opentelemetry-instrumentation-cassandra": "0.25.0",
"plugins/node/opentelemetry-instrumentation-connect": "0.25.0",
"plugins/node/opentelemetry-instrumentation-dns": "0.25.0",
"plugins/node/opentelemetry-instrumentation-express": "0.25.0",
"plugins/node/opentelemetry-instrumentation-generic-pool": "0.25.0",
"plugins/node/opentelemetry-instrumentation-graphql": "0.25.0",
"plugins/node/opentelemetry-instrumentation-hapi": "0.25.0",
"plugins/node/opentelemetry-instrumentation-ioredis": "0.25.0",
"plugins/node/opentelemetry-instrumentation-knex": "0.25.0",
"plugins/node/opentelemetry-instrumentation-koa": "0.25.0",
"plugins/node/opentelemetry-instrumentation-memcached": "0.25.0",
"plugins/node/opentelemetry-instrumentation-mongodb": "0.25.0",
"plugins/node/opentelemetry-instrumentation-mysql": "0.25.0",
"plugins/node/opentelemetry-instrumentation-mysql2": "0.25.0",
"plugins/node/opentelemetry-instrumentation-nestjs-core": "0.25.0",
"plugins/node/opentelemetry-instrumentation-net": "0.25.0",
"plugins/node/opentelemetry-instrumentation-pg": "0.25.0",
"plugins/node/opentelemetry-instrumentation-pino": "0.25.0",
"plugins/node/opentelemetry-instrumentation-redis": "0.25.0",
"plugins/node/opentelemetry-instrumentation-restify": "0.25.0",
"plugins/node/opentelemetry-instrumentation-router": "0.25.0",
"plugins/node/opentelemetry-instrumentation-winston": "0.25.0",
"plugins/web/opentelemetry-instrumentation-document-load": "0.25.0",
"plugins/web/opentelemetry-instrumentation-user-interaction": "0.25.0",
"plugins/web/opentelemetry-plugin-react-load": "0.25.0",
"propagators/opentelemetry-propagator-aws-xray": "0.25.0",
"propagators/opentelemetry-propagator-grpc-census-binary": "0.25.0",
"propagators/opentelemetry-propagator-ot-trace": "0.25.0"
}
25 changes: 3 additions & 22 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
# Releasing OpenTelemetry Packages (for Maintainers Only)

This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number.

## Auto-generate a Release PR

Navigate to the [Create a Release PR Worflow](https://github.com/open-telemetry/opentelemetry-js-contrib/actions/workflows/release-pr.yml). Click the "Run workflow" dropdown, enter the semver-compliant version to release, then click "Run workflow". It will generate a release pull request from a branch named like `release/x.y.z`.

## Review Release PR

If necessary, update sample code or documentation on the `release/x.y.z` branch to be included in the release. Another maintainer should approve the PR, specifically validating the automatic updates and verifying the tests are passing.

NOTE: If any major changes are merged while the release PR is open, the CHANGELOG on the `release/x.y.z` branch must be manually updated to reflect the change.

## Merge Release PR

After approval, merge the release PR. This will automatically publish all packages. Verify:

* The [publish workflow](https://github.com/open-telemetry/opentelemetry-js-contrib/actions/workflows/publish.yml) runs successfully
* The new version is available in NPM, e.g. for the [Express instrumentation package](https://www.npmjs.com/package/@opentelemetry/instrumentation-express)
* A [GitHub Release](https://github.com/open-telemetry/opentelemetry-js-contrib/releases) was cut correctly, with a tag pointing to the new version, and a body of the changelog

That's it! No need to read on unless something above went wrong.
This repository uses [Release Please](https://github.com/googleapis/release-please) to manage its releases automatically and independently.
Modified packages are automatically published to NPM when the auto-generated Release Please PR is merged.

# Manual Publishing Process

If any step of the above automated process fails, complete the release manually by picking up at the failed step.
For posterity, or in the event of any failures with release-please, the process for performing a manual release is below.

Manual Release Process Steps:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"compile": "npm run version:update && tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"precompile": "tsc --version && lerna run version --scope $(npm pkg get name) --include-filtered-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"compile": "npm run version:update && tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"precompile": "tsc --version && lerna run version --scope $(npm pkg get name) --include-filtered-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"compile": "npm run version:update && tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"precompile": "tsc --version && lerna run version --scope $(npm pkg get name) --include-filtered-dependencies",
"prewatch": "npm run precompile",
"prepare": "npm run compile",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
Loading