Skip to content

Commit 7e50927

Browse files
authored
Update deps and add GitHub Actions (#50)
* Update deps and add GitHub Actions * Fix build script * Fix version-from-git * Propagate versions and copy documents * Fix build order * Fix lerna location * Build Pages * Fix build break * Set paths * Uncomment release
1 parent e0fa23e commit 7e50927

File tree

10 files changed

+4156
-6585
lines changed

10 files changed

+4156
-6585
lines changed

.github/workflows/node.js.yml

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
tags:
11+
- '*'
12+
13+
pull_request:
14+
branches:
15+
- master
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
matrix:
23+
node-version: [12.x, 14.x]
24+
25+
steps:
26+
- name: Checking out for ${{ github.ref }}
27+
uses: actions/checkout@v2
28+
29+
- name: Use Node.js ${{ matrix.node-version }}
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: ${{ matrix.node-version }}
33+
34+
- name: Run npx version-from-git --no-git-tag-version
35+
if: ${{ startsWith(github.ref, 'refs/heads/') }}
36+
run: |
37+
cd packages/component
38+
npx version-from-git --no-git-tag-version
39+
40+
- run: npm ci
41+
42+
- run: npm run bootstrap
43+
44+
- name: Propagate versions
45+
run: |
46+
node_modules/.bin/lerna version --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version`
47+
48+
- run: npm run build --if-present
49+
50+
- run: npm test
51+
52+
- name: Copy documents
53+
run: |
54+
cp CHANGELOG.md packages/component
55+
cp LICENSE packages/component
56+
cp README.md packages/component
57+
58+
- name: Run npm pack
59+
run: |
60+
cd packages/component
61+
npm pack
62+
63+
- name: Upload npm-tarball
64+
uses: actions/upload-artifact@v2
65+
if: ${{ matrix.node-version == '14.x' }}
66+
with:
67+
name: npm-tarball
68+
path: 'packages/component/*.tgz'
69+
70+
- name: Upload gh-pages
71+
uses: actions/upload-artifact@v2
72+
if: ${{ matrix.node-version == '14.x' }}
73+
with:
74+
name: gh-pages
75+
path: 'packages/playground/build/**/*'
76+
77+
publish:
78+
needs: build
79+
runs-on: ubuntu-latest
80+
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }}
81+
82+
steps:
83+
- name: Download npm-tarball
84+
uses: actions/download-artifact@v2
85+
with:
86+
name: npm-tarball
87+
88+
- name: Download gh-pages
89+
uses: actions/download-artifact@v2
90+
with:
91+
name: gh-pages
92+
path: gh-pages/
93+
94+
- name: Read package.json
95+
id: read-package-json
96+
run: |
97+
echo "::set-output name=name::$(tar xOf *.tgz package/package.json | jq -r '.name')"
98+
echo "::set-output name=version::$(tar xOf *.tgz package/package.json | jq -r '.version')"
99+
echo "::set-output name=tarball::$(ls *.tgz)"
100+
echo "::set-output name=date::$(date +%Y-%m-%d)"
101+
102+
- name: Run npm publish ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }}
103+
run: |
104+
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
105+
npm publish *.tgz --tag master
106+
107+
- name: Run npm dist-tag add ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }} latest
108+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
109+
run: |
110+
npm dist-tag add ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }} latest
111+
112+
- name: Draft a new release
113+
uses: actions/create-release@v1
114+
id: create-release
115+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
116+
env:
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
with:
119+
tag_name: ${{ github.ref }}
120+
release_name: '[${{ steps.read-package-json.outputs.version }}] - ${{ steps.read-package-json.outputs.date }}'
121+
draft: true
122+
123+
- name: Upload tarball to release
124+
uses: actions/upload-release-asset@v1
125+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
with:
129+
upload_url: ${{ steps.create-release.outputs.upload_url }}
130+
asset_path: ./${{ steps.read-package-json.outputs.tarball }}
131+
asset_name: ${{ steps.read-package-json.outputs.tarball }}
132+
asset_content_type: application/octet-stream
133+
134+
- name: Deploy to GitHub Pages
135+
uses: peaceiris/actions-gh-pages@v3
136+
with:
137+
github_token: ${{ secrets.GITHUB_TOKEN }}
138+
publish_dir: ./gh-pages/

.travis.yml

-47
This file was deleted.

CHANGELOG.md

+32
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,29 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Bump dependencies, in PR [#XXX](https://github.com/compulim/react-scroll-to-bottom/pull/XXX)
12+
- [`@babel/cli@7.10.3`](https://www.npmjs.com/package/@babel/cli)
13+
- [`@babel/core@7.10.3`](https://www.npmjs.com/package/@babel/core)
14+
- [`@babel/plugin-proposal-object-rest-spread@7.10.3`](https://www.npmjs.com/package/@babel/plugin-proposal-object-rest-spread)
15+
- [`@babel/preset-env@7.10.3`](https://www.npmjs.com/package/@babel/preset-env)
16+
- [`@babel/preset-react@7.10.1`](https://www.npmjs.com/package/@babel/preset-react)
17+
- [`eslint@7.3.0`](https://www.npmjs.com/package/eslint)
18+
- [`eslint-plugin-prettier@3.1.4`](https://www.npmjs.com/package/eslint-plugin-prettier)
19+
- [`eslint-plugin-react@7.20.0`](https://www.npmjs.com/package/eslint-plugin-react)
20+
- [`eslint-plugin-react-hooks@4.0.4`](https://www.npmjs.com/package/eslint-plugin-react-hooks)
21+
922
## [2.0.0] - 2020-05-07
1023

1124
### Breaking changes
25+
1226
- We moved to React Hooks and it requires React 16.8.6 or up
1327
- Hooks will allow us to write simpler and more maintainable code
1428
- Developers can use our React Hooks to perform various operations
1529

1630
### Changed
31+
1732
- Moved all code to React functional components, in PR [#31](https://github.com/compulim/react-scroll-to-bottom/pull/31)
1833
- `*`: bump dependencies, in PR [#47](https://github.com/compulim/react-scroll-to-bottom/pull/47)
1934
- [`@babel/cli@7.8.4`](https://www.npmjs.com/package/@babel/cli)
@@ -50,37 +65,49 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
5065
- [`rimraf@^2.6.3`](https://www.npmjs.com/package/rimraf)
5166

5267
### Added
68+
5369
- Added React Hooks, in PR [#31](https://github.com/compulim/react-scroll-to-bottom/pull/31)
5470
- Added [ESLint](https://www.npmjs.com/package/eslint) and [Prettier](https://www.npmjs.com/package/prettier), in PR [#31](https://github.com/compulim/react-scroll-to-bottom/pull/31)
5571

5672
### Fixed
73+
5774
- Fix `atStart` was not reporting correctly, in PR [#31](https://github.com/compulim/react-scroll-to-bottom/pull/31)
5875
- Chrome: Fix scroll to bottom button should hide when using <kbd>TAB</kbd> to scroll the bottommost button into view, in PR [#46](https://github.com/compulim/react-scroll-to-bottom/pull/46)
5976

6077
## [1.3.2] - 2019-06-20
78+
6179
### Changed
80+
6281
- `*`: bumped to `babel-jest@24.8.0`, `lerna@3.15.0`, and `jest@24.8.0`, in PR [#22](https://github.com/compulim/react-scroll-to-bottom/pull/22)
6382

6483
### Fixed
84+
6585
- `Composer`: fix [#22](https://github.com/compulim/react-scroll-to-bottom/issue/22), synthetic `scroll` events crafted by Chrome should not cause stickiness to lose, in PR [#23](https://github.com/compulim/react-scroll-to-bottom/issue/23)
6686

6787
## [1.3.1] - 2019-02-13
88+
6889
### Changed
90+
6991
- `Composer`: fix [#13](https://github.com/compulim/react-scroll-to-bottom/issue/13), user scrolling in Firefox may have the scroll position locked occasionally, in PR [#12](https://github.com/compulim/react-scroll-to-bottom/pull/12)
7092
- `SpineTo`: fix [#10](https://github.com/compulim/react-scroll-to-bottom/issue/10), set stopping threshold from `0.5` to `1.5`, in PR [#14](https://github.com/compulim/react-scroll-to-bottom/pull/14)
7193
- `Composer`: fix [#15](https://github.com/compulim/react-scroll-to-bottom/issue/15), set near-end threshold from `0` to (less than) `1`, in PR [#16](https://github.com/compulim/react-scroll-to-bottom/pull/16)
7294

7395
## [1.3.0] - 2019-01-21
96+
7497
### Changed
98+
7599
- Playground: bumped to `react@16.6.0`, `react-dom@16.6.0`, and `react-scripts@2.1.6`
76100
- `*`: Update algorithm, instead of using `componentDidUpdate`, we now use `setInterval` to check if the panel is sticky or not, this help to track content update that happen outside of React lifecycle, for example, `HTMLImageElement.onload` event
77101
- `Composer`: `scrollTo()` now accepts `"100%"` instead of `"bottom"`
78102

79103
### Removed
104+
80105
- Removed `threshold` props because the algorithm is now more robust
81106

82107
## [1.2.0] - 2018-10-28
108+
83109
### Added
110+
84111
- `AutoHideFollowButton`: will now hide when it start animating scroll position
85112
- `BasicScrollToBottom`: will now pass `debounce` and `threshold` to `Composer`, fix [#2](https://github.com/compulim/react-scroll-to-bottom/issues/2)
86113
- `Composer`: `debounce` prop to control debouncing on `onScroll` event, default to `17`
@@ -91,6 +118,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
91118
- `StateContext`: `atStart` indicates if the scroll position is at the start or not, depend on `mode`
92119

93120
### Changed
121+
94122
- Performance improvements
95123
- `Context` is now separated into `FunctionContext`, `InternalContext` and `StateContext` for better performance and reduce exposure
96124
- `FunctionContext` is static and only hold functions for manipulating the panel
@@ -101,9 +129,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
101129
- [`lerna`](https://npmjs.com/package/lerna) bumped from `2.11.0` to `3.4.3`
102130

103131
## [1.1.0] - 2018-06-22
132+
104133
### Added
134+
105135
- Container class name
106136

107137
## [1.0.0] - 2018-06-17
138+
108139
### Added
140+
109141
- Initial release

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 William Wong
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)