-
Notifications
You must be signed in to change notification settings - Fork 15
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
1 parent
d6c27ab
commit 1213527
Showing
2 changed files
with
97 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,63 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: "*" | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
publish: | ||
name: Publish package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
registry-url: "https://registry.npmjs.org" | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
run_install: false | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref }} | ||
- name: Install dependencies | ||
id: deps | ||
run: | | ||
pnpm install | ||
- name: Build release | ||
id: build_release | ||
run: | | ||
pnpm build | ||
- name: Run Tests | ||
id: tests | ||
run: | | ||
pnpm test | ||
- name: Publish Release | ||
if: steps.tests.outcome == 'success' | ||
run: | | ||
if [ "$NODE_AUTH_TOKEN" = "" ]; then | ||
echo "You need a NPM_TOKEN secret in order to publish." | ||
false | ||
fi | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
echo //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} > .npmrc | ||
EXTRA_ARGS="" | ||
if [[ $VERSION == *"alpha."* ]] || [[ $VERSION == *"beta."* ]] || [[ $VERSION == *"rc."* ]]; then | ||
echo "Is pre-release version" | ||
EXTRA_ARGS="$EXTRA_ARGS --dist-tag next" | ||
fi | ||
npm publish ${VERSION} --force-publish $EXTRA_ARGS | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Tag release | ||
if: steps.tests.outcome == 'success' | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_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,34 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review, review_requested] | ||
branches: | ||
- main | ||
jobs: | ||
run-tests: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
registry-url: "https://registry.npmjs.org" | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
run_install: false | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref }} | ||
- name: Install and build | ||
run: | | ||
pnpm install | ||
pnpm build | ||
- name: Lint and run tests | ||
run: | | ||
pnpm lint | ||
pnpm test |