-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add release process for js repository (#251)
* chore(ci): add release process for js repository * chore: rename * chore: update github action * chore: restore test version * chore: pin devDep * chore: clean up code * chore: convert to typescript * chore: remove version from umbrella package.json for js packages * Update clients/algoliasearch-client-javascript/scripts/publish.ts Co-authored-by: Clément Vannicatte <[email protected]> * chore: include .npmrc Co-authored-by: Clément Vannicatte <[email protected]>
- Loading branch information
1 parent
be08ed2
commit 0f9b48f
Showing
8 changed files
with
3,392 additions
and
141 deletions.
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 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 }} |
This file contains 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 @@ | ||
//registry.npmjs.org/:_authToken=${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 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 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 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
36 changes: 36 additions & 0 deletions
36
clients/algoliasearch-client-javascript/scripts/publish.ts
This file contains 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 @@ | ||
import fsp from 'fs/promises'; | ||
import path from 'path'; | ||
|
||
import { execaCommand } from 'execa'; | ||
import semver from 'semver'; | ||
|
||
async function publish(): Promise<void> { | ||
// Read the local version of `algoliasearch/package.json` | ||
const { version } = JSON.parse( | ||
( | ||
await fsp.readFile( | ||
path.resolve( | ||
__dirname, | ||
'..', | ||
'packages', | ||
'algoliasearch', | ||
'package.json' | ||
) | ||
) | ||
).toString() | ||
); | ||
|
||
// Get tag like `alpha`, `beta`, ... | ||
const tag = semver.prerelease(version)?.[0]; | ||
|
||
await execaCommand( | ||
`lerna exec --no-bail npm publish --access public ${ | ||
tag ? `--tag ${tag}` : '' | ||
}`, | ||
{ | ||
shell: 'bash', | ||
} | ||
); | ||
} | ||
|
||
publish(); |
Oops, something went wrong.