Skip to content

Commit

Permalink
feat(release): setup semantic release, husky, and github actions (roe…
Browse files Browse the repository at this point in the history
…rohan#7)

* feat(release): setup semantic release, husky, and github actions

* fix(tests): test script changed back to react-scripts test

* fix(actions): name of github action was fixed
  • Loading branch information
roerohan authored Sep 26, 2021
1 parent 7a58264 commit 5380a75
Show file tree
Hide file tree
Showing 11 changed files with 25,773 additions and 14,458 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
src/noVNC
src/noVNC
build/
dist/
41 changes: 41 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Check for lint/build errors
on:
pull_request:
branches:
- "**"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: npm install, lint
run: |
npm install
npm run lint
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: npm install, build
run: |
npm install
npm run build
58 changes: 19 additions & 39 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,32 @@
name: Publish NPM package and Release on GitHub

name: Release to NPM Registry
on:
push:
branches: [master]

branches:
- main
jobs:
publish:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2
- name: Checkout
uses: actions/checkout@v2
with:
node-version: 15
registry-url: https://registry.npmjs.org/
submodules: recursive

- run: git fetch --all --tags

- name: Check version change
uses: thebongy/version-check@v1
id: check
- uses: actions/setup-node@v2
with:
file: package.json
failBuild: false
tagFormat: v${version}

- name: Echo variables
run: |
echo "versionChanged- ${{steps.check.outputs.versionChanged}}"
echo "releaseVersion- ${{steps.check.outputs.releaseVersion}}"
node-version: 16
registry-url: https://registry.npmjs.org/

- if: steps.check.outputs.versionChanged == 'true'
run: |
git submodule update --init --recursive
npm install
- name: Install dependencies
run: npm install

- if: steps.check.outputs.versionChanged == 'true'
run: npm run publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
- name: Build package
run: npm run build

- name: Create Release
id: create_release
uses: actions/create-release@v1
if: steps.check.outputs.versionChanged == 'true'
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.check.outputs.releaseVersion }}
release_name: Release ${{ steps.check.outputs.releaseVersion }}
draft: false
prerelease: false
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: npx semantic-release
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit ""
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint:fix
4 changes: 4 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

exec < /dev/tty && npx git-cz --hook || true
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.github/
.husky/
build/
node_modules/
src/
.eslintignore
.gitignore
.gitmodules
.npmignore
.releaserc.json
package-lock.json
prepublish.js
rollup.config.js
tsconfig.json
35 changes: 35 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"npmPublish": true,
"tarballDir": "dist"
}
],
[
"@semantic-release/git",
{
"assets": [
"package.json",
"package-lock.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}\n\n\nskip-checks: true"
}
],
[
"@semantic-release/github",
{
"assets": "dist/*.tgz"
}
]
],
"repositoryUrl": "https://github.com/roerohan/react-vnc"
}
Loading

0 comments on commit 5380a75

Please sign in to comment.