Skip to content

Commit

Permalink
feat: add publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
yue4u committed Sep 26, 2023
1 parent 71fa8c9 commit ffc44d6
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/publish.yml
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*/

0 comments on commit ffc44d6

Please sign in to comment.