-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
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,68 @@ | ||
name: Publish to npmjs | ||
|
||
on: | ||
# Who has permission to workflow_dispatch | ||
# https://github.com/orgs/community/discussions/26622 | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version to release' | ||
required: true | ||
|
||
jobs: | ||
fetch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
# checkout is pinned to dev branch here | ||
ref: dev | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: './.node-version' | ||
- name: Cache Deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
node_modules | ||
packages/*/node_modules | ||
key: ${{ runner.os }}-yarn-${{ hashFiles( 'yarn.lock' ) }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Fetch Deps | ||
run: yarn install --frozen-lockfile | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: fetch | ||
permissions: | ||
contents: write | ||
id-token: write | ||
steps: | ||
- name: Set git username and email | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "actions-user" | ||
- name: Set package version | ||
run: | | ||
yarn lerna version ${{ github.event.inputs.version }} --exact --no-push --yes | ||
yarn lerna publish from-git --dist-tag latest | ||
env: | ||
NPM_CONFIG_PROVENANCE: true | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Git push version up commits | ||
run: | | ||
git push origin ${{ github.ref_name }} | ||
- name: Upload Builds | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build | ||
path: | | ||
packages/*/lib/ | ||
packages/*/types/ | ||
packages/*/ts*/ |