Skip to content

Commit

Permalink
feat(api): manual updates
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed May 22, 2024
1 parent 5328075 commit d4a083a
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 18 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Create releases
on:
schedule:
- cron: '0 5 * * *' # every day at 5am UTC
push:
branches:
- main

jobs:
release:
name: release
if: github.ref == 'refs/heads/main' && github.repository == 'meorphis/meorphis-test'
runs-on: ubuntu-latest
environment: production-release

steps:
- uses: actions/checkout@v4

- uses: stainless-api/trigger-release-please@v1
id: release
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}

- name: Set up Node
if: ${{ steps.release.outputs.releases_created }}
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
if: ${{ steps.release.outputs.releases_created }}
run: |
yarn install
- name: Publish to NPM
if: ${{ steps.release.outputs.releases_created }}
run: |
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.MEORPHIS_TEST_40_NPM_TOKEN || secrets.NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/handle-release-pr-title-edit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Handle release PR title edits
on:
pull_request:
types:
- edited
- unlabeled

jobs:
update_pr_content:
name: Update pull request content
if: |
((github.event.action == 'edited' && github.event.changes.title.from != github.event.pull_request.title) ||
(github.event.action == 'unlabeled' && github.event.label.name == 'autorelease: custom version')) &&
startsWith(github.event.pull_request.head.ref, 'release-please--') &&
github.event.pull_request.state == 'open' &&
github.event.sender.login != 'stainless-bot' &&
github.event.sender.login != 'stainless-app' &&
github.repository == 'meorphis/meorphis-test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: stainless-api/trigger-release-please@v1
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
8 changes: 2 additions & 6 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to NPM in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/meorphis/test-repo-1/actions/workflows/publish-npm.yml
# workflow for re-running publishing to NPM in case it fails for some reason
# you can run this workflow by navigating to https://www.github.com/meorphis/meorphis-test/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: release doctor
runs-on: ubuntu-latest
environment: production-release
if: github.repository == 'meorphis/test-repo-1' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
if: github.repository == 'meorphis/meorphis-test' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4
Expand All @@ -19,4 +19,5 @@ jobs:
run: |
bash ./bin/check-release-environment
env:
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
NPM_TOKEN: ${{ secrets.MEORPHIS_TEST_40_NPM_TOKEN || secrets.NPM_TOKEN }}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```bash
npm install git+ssh://[email protected]:meorphis/test-repo-1.git
npm install git+ssh://[email protected]:meorphis/meorphis-test.git
```

Alternatively, to link a local copy of the repo:

```bash
# Clone
git clone https://www.github.com/meorphis/test-repo-1
cd test-repo-1
git clone https://www.github.com/meorphis/meorphis-test
cd meorphis-test

# With yarn
yarn link
Expand Down Expand Up @@ -99,7 +99,7 @@ the changes aren't made through the automated pipeline, you may want to make rel

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/meorphis/test-repo-1/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/meorphis/meorphis-test/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ import MeorphisTest40 from 'test-repo-1';
```

To do the inverse, add `import "test-repo-1/shims/node"` (which does import polyfills).
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/meorphis/test-repo-1/tree/main/src/_shims#readme)).
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/meorphis/meorphis-test/tree/main/src/_shims#readme)).

### Logging and middleware

Expand Down Expand Up @@ -287,7 +287,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/meorphis/test-repo-1/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/meorphis/meorphis-test/issues) with questions, bugs, or suggestions.

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ or products provided by Meorphis Test 40 please follow the respective company's

### Meorphis Test 40 Terms and Policies

Please contact api-help2@bolt.com for any questions or concerns regarding security of our services.
Please contact api-help3@bolt.com for any questions or concerns regarding security of our services.

---

Expand Down
4 changes: 4 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
warnings=()
errors=()

if [ -z "${STAINLESS_API_KEY}" ]; then
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
fi

if [ -z "${NPM_TOKEN}" ]; then
warnings+=("The MEORPHIS_TEST_40_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "test-repo-1",
"version": "0.0.1-alpha.0",
"description": "The official TypeScript library for the Meorphis Test 40 API",
"author": "Meorphis Test 40 <api-help2@bolt.com>",
"author": "Meorphis Test 40 <api-help3@bolt.com>",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"type": "commonjs",
"repository": "github:meorphis/test-repo-1",
"repository": "github:meorphis/meorphis-test",
"license": "Apache-2.0",
"packageManager": "[email protected]",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/_shims/index-deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function getDefaultAgent(url: string) {
}
export function fileFromPath() {
throw new Error(
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/meorphis/test-repo-1#file-uploads',
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/meorphis/meorphis-test#file-uploads',
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/_shims/web-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean }
getDefaultAgent: (url: string) => undefined,
fileFromPath: () => {
throw new Error(
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/meorphis/test-repo-1#file-uploads',
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/meorphis/meorphis-test#file-uploads',
);
},
isFsReadStream: (value: any) => false,
Expand Down

0 comments on commit d4a083a

Please sign in to comment.