diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..faf6e81 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,33 @@ +# 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 +name: Publish NPM +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + environment: production-release + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: | + yarn install + + - name: Publish to NPM + run: | + bash ./bin/publish-npm + env: + NPM_TOKEN: ${{ secrets.MEORPHIS_TEST_40_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..735ec34 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,22 @@ +name: Release Doctor +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + 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') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + NPM_TOKEN: ${{ secrets.MEORPHIS_TEST_40_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..67dcd73 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1-alpha.0" +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fbda69..de0fd43 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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://git@github.com:meorphis/meorphis-test.git +npm install git+ssh://git@github.com:meorphis/test-repo-1.git ``` Alternatively, to link a local copy of the repo: ```bash # Clone -git clone https://www.github.com/meorphis/meorphis-test -cd meorphis-test +git clone https://www.github.com/meorphis/test-repo-1 +cd test-repo-1 # With yarn yarn link @@ -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/meorphis-test/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/test-repo-1/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index 960f68b..7818dbd 100644 --- a/README.md +++ b/README.md @@ -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/meorphis-test/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/test-repo-1/tree/main/src/_shims#readme)). ### Logging and middleware @@ -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/meorphis-test/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/meorphis/test-repo-1/issues) with questions, bugs, or suggestions. ## Requirements diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..bf5d9a1 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +warnings=() +errors=() + +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 + +lenWarnings=${#warnings[@]} + +if [[ lenWarnings -gt 0 ]]; then + echo -e "Found the following warnings in the release environment:\n" + + for warning in "${warnings[@]}"; do + echo -e "- $warning\n" + done +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/package.json b/package.json index 2db48f8..0df7a0f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "dist/index.d.ts", "main": "dist/index.js", "type": "commonjs", - "repository": "github:meorphis/meorphis-test", + "repository": "github:meorphis/test-repo-1", "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..624ed99 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "node", + "extra-files": [ + "src/version.ts", + "README.md" + ] +} diff --git a/src/_shims/index-deno.ts b/src/_shims/index-deno.ts index 6689bcd..70a2d25 100644 --- a/src/_shims/index-deno.ts +++ b/src/_shims/index-deno.ts @@ -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/meorphis-test#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/meorphis/test-repo-1#file-uploads', ); } diff --git a/src/_shims/web-runtime.ts b/src/_shims/web-runtime.ts index c9fa9a5..e5d3410 100644 --- a/src/_shims/web-runtime.ts +++ b/src/_shims/web-runtime.ts @@ -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/meorphis-test#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/meorphis/test-repo-1#file-uploads', ); }, isFsReadStream: (value: any) => false, diff --git a/src/version.ts b/src/version.ts index 55a1a52..db692bc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.0.1-alpha.0'; +export const VERSION = '0.0.1-alpha.0'; // x-release-please-version