Skip to content

Commit d7aa354

Browse files
[chore] Adding publish workflow (#319)
## Why Adding release-drafter and publish workflow ## What changed <!-- Describe the changes you made in this pull request or pointers for the reviewer --> ## Versioning - [ ] Breaking protocol change - [ ] Breaking ts/js API change <!-- Kind reminder to add tests and updated documentation if needed -->
1 parent f6bd878 commit d7aa354

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Upload Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'What version to use for the release'
10+
required: true
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- name: Set release version
25+
run: |
26+
tag="${{ github.event.inputs.version }}"
27+
if [ -z "$tag" ]; then
28+
tag="${GITHUB_REF_NAME}"
29+
fi
30+
version="${tag#v}" # Strip leading v
31+
32+
# Bump library tag
33+
npm version --no-git-tag-version "$version"
34+
35+
git config user.name 'GitHub Actions'
36+
git config user.email eng+github@repl.it
37+
38+
git commit -m 'Setting version' package.json
39+
40+
- name: Build and publish
41+
run: |
42+
npm set "//registry.npmjs.org/:_authToken" "${{ secrets.NPMJS_AUTH_TOKEN }}"
43+
npm install --frozen-lockfile
44+
npm run publish
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release Drafter
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
# branches to consider in the event; optional, defaults to all
7+
branches:
8+
- main
9+
# pull_request event is required only for autolabeler
10+
pull_request:
11+
# Only following types are handled by the action, but one can default to all as well
12+
types: [opened, reopened, synchronize]
13+
# pull_request_target event is required for autolabeler to support PRs from forks
14+
pull_request_target:
15+
types: [opened, reopened, synchronize]
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
update_release_draft:
22+
permissions:
23+
# write permission is required to create a github release
24+
contents: write
25+
# write permission is required for autolabeler
26+
# otherwise, read permission is required at least
27+
pull-requests: write
28+
runs-on: ubuntu-latest
29+
steps:
30+
# Drafts your next Release notes as Pull Requests are merged into "master"
31+
- uses: release-drafter/release-drafter@v5
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)