- Notifications
You must be signed in to change notification settings - Fork 27
chore(ci): add release process for js repository #251
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
16 commits Select commit Hold shift + click to select a range
1712478 chore(ci): add release process for js repository
eunjae-lee 80dd12d chore: rename
eunjae-lee c8aa0e4 Merge branch 'main' into chore/release-js
eunjae-lee 7da25e2 chore: update github action
eunjae-lee c3fe9b5 chore: restore test version
eunjae-lee 8bc7913 chore: pin devDep
eunjae-lee fcc0b99 chore: clean up code
eunjae-lee fcf1071 Merge branch 'main' into chore/release-js
eunjae-lee d1c1a49 Merge branch 'chore/release-js' of github.com:algolia/api-clients-aut…
eunjae-lee 047f61f chore: convert to typescript
eunjae-lee e1939f2 chore: remove version from umbrella package.json for js packages
eunjae-lee b6247f8 Merge branch 'main' into chore/release-js
eunjae-lee 59eb180 Merge branch 'main' into chore/release-js
eunjae-lee 25ad706 Update clients/algoliasearch-client-javascript/scripts/publish.ts
eunjae-lee adb5064 chore: include .npmrc
eunjae-lee 7255dd7 Merge branch 'main' into chore/release-js
eunjae-lee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions 36 clients/algoliasearch-client-javascript/.github/workflows/release.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: Release packages | ||
| | ||
| on: | ||
| push: | ||
| branches: | ||
| - next | ||
| | ||
| jobs: | ||
| release: | ||
| name: Publish | ||
| runs-on: ubuntu-20.04 | ||
| if: "startsWith(github.event.issue.title, 'chore: release v')" | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| | ||
| - name: Install Node | ||
| uses: actions/setup-node@v2 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: yarn | ||
| | ||
| - name: Install JavaScript dependencies | ||
| shell: bash | ||
| run: yarn install | ||
| | ||
| - name: Build clients | ||
| shell: bash | ||
| run: yarn build | ||
| | ||
| - name: Publish to NPM | ||
| shell: bash | ||
| run: yarn release:publish | ||
| env: | ||
| NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
768 changes: 768 additions & 0 deletions 768 clients/algoliasearch-client-javascript/.yarn/releases/yarn-3.1.1.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| nodeLinker: node-modules | ||
| | ||
| yarnPath: .yarn/releases/yarn-3.1.1.cjs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "packages": ["packages/*"], | ||
| "version": "independent" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions 37 clients/algoliasearch-client-javascript/scripts/publish.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/usr/bin/env node | ||
eunjae-lee marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| /* eslint-disable @typescript-eslint/no-var-requires */ | ||
| /* eslint-disable import/no-commonjs */ | ||
| | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| | ||
| const execa = require('execa'); | ||
| const semver = require('semver'); | ||
| | ||
| async function publish() { | ||
| await execa.command( | ||
| `npm config set "registry.npmjs.org/:_authToken=${process.env.NPM_AUTH_TOKEN}"`, | ||
| { | ||
| shell: 'bash', | ||
| } | ||
| ); | ||
| // Read the local version of `algoliasearch/package.json` | ||
| const { version } = JSON.parse( | ||
| fs.readFileSync( | ||
| path.resolve(__dirname, '..', 'packages', 'algoliasearch', 'package.json') | ||
| ) | ||
| ); | ||
| // Get tag like `alpha`, `beta`, ... | ||
| const tag = semver.prerelease(version)?.[0]; | ||
| | ||
| await execa.command( | ||
| `lerna exec --no-bail npm publish --access public ${ | ||
| tag ? `--tag ${tag}` : '' | ||
| }`, | ||
| { | ||
| shell: 'bash', | ||
| } | ||
| ); | ||
| } | ||
| | ||
| publish(); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.