Skip to content

Commit 7ed5cc3

Browse files
authored
Merge pull request #60 from ubilabs/chore/workflows
Chore/workflows
2 parents ebc420d + 938e61b commit 7ed5cc3

File tree

6 files changed

+83
-13
lines changed

6 files changed

+83
-13
lines changed

.github/workflows/publish.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
name: Publish package
2+
23
on:
34
push:
45
tags:
56
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
7+
68
jobs:
79
create-release:
810
name: Create Release
911
runs-on: ubuntu-latest
1012
outputs:
1113
upload_url: ${{ steps.create_release.outputs.upload_url }}
12-
1314
steps:
1415
- name: Create Release
1516
id: create_release
@@ -26,12 +27,27 @@ jobs:
2627
name: Publish to NPM
2728
runs-on: ubuntu-latest
2829
steps:
29-
- uses: actions/checkout@v2
30-
- uses: actions/setup-node@v2
30+
- name: Checkout repository from GitHub
31+
uses: actions/[email protected]
32+
- name: Setup npm
33+
uses: actions/setup-node@v2
3134
with:
32-
node-version: "12.x"
35+
node-version: "16"
3336
registry-url: "https://registry.npmjs.org"
34-
- run: npm install
35-
- run: npm publish --access public
37+
# npm cache folder is in ~/, not within the working directory
38+
- name: Cache npm directory
39+
uses: actions/cache@v2
40+
with:
41+
path: ~/.npm
42+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
43+
restore-keys: |
44+
${{ runner.os }}-node-
45+
# Node auth token is needed for private GitHub registry
46+
- name: Install dependencies
47+
run: npm install
48+
- name: Run tests
49+
run: npm run test
50+
- name: Publish
51+
run: npm publish --access public
3652
env:
3753
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOT_ACCESS_TOKEN }}

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Tests
2+
3+
on: push
4+
5+
jobs:
6+
create-release:
7+
name: Test
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 8
10+
steps:
11+
- name: Checkout repository from GitHub
12+
uses: actions/[email protected]
13+
- name: Setup npm
14+
uses: actions/setup-node@v2
15+
with:
16+
node-version: "16"
17+
# npm cache folder is in ~/, not within the working directory
18+
- name: Cache npm directory
19+
uses: actions/cache@v2
20+
with:
21+
path: ~/.npm
22+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-node-
25+
# Node auth token is needed for private GitHub registry
26+
- name: Install dependencies
27+
run: npm install
28+
- name: Run tests
29+
run: npm run test

examples/basic-google-map/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ This is an example setup to show a **basic Google Map** with the Google Maps Rea
66

77
To run this project, clone the Google Maps React Hooks repository locally.
88

9-
At the root of the repository, run:
9+
First go to the root of the repository and run
10+
11+
```shell
12+
npm install
13+
```
14+
15+
once to install all dependencies.
16+
17+
Then start this example locally with
1018

1119
```shell
1220
npm run start:sample-map

examples/geocoding/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ This is an example setup to show the usage of the **useGeocoder hook** with the
66

77
To run this project, clone the Google Maps React Hooks repository locally.
88

9-
At the root of the repository, run:
9+
First go to the root of the repository and run
10+
11+
```shell
12+
npm install
13+
```
14+
15+
once to install all dependencies.
16+
17+
Then start this example locally with
1018

1119
```shell
1220
npm run start:geocoding-example

examples/google-map-with-markers/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ This is an example setup to show a **Google Map with markers** with the Google M
66

77
To run this project, clone the Google Maps React Hooks repository locally.
88

9-
At the root of the repository, run:
9+
First go to the root of the repository and run
10+
11+
```shell
12+
npm install
13+
```
14+
15+
once to install all dependencies.
16+
17+
Then start this example locally with
1018

1119
```shell
1220
npm run start:map-with-markers

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
"scripts": {
1515
"build": "rm -rf dist/* && microbundle -o dist/index.js -f modern,umd --external react=React --sourcemap false --jsx React.createElement --no-compress --tsconfig ./tsconfig.json",
1616
"dev": "rm -rf dist/* && microbundle watch -o dist/index.js -f modern,umd --external react=React --sourcemap false --jsx React.createElement --no-compress --tsconfig ./tsconfig.json",
17-
"lint": "eslint './src/**/*.{ts,tsx}'",
17+
"lint": "eslint './{src,examples}/**/*.{ts,tsx}'",
1818
"types": "tsc --project tsconfig.json --noEmit",
1919
"test": "npm run lint && npm run types",
2020
"prepublishOnly": "npm run test && npm run build",
2121
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
2222
"preversion": "npm run test",
2323
"version": "npm run changelog && git checkout -b chore/release-${npm_package_version} && git add .",
2424
"postversion": "git push -u origin chore/release-${npm_package_version} && git push --tags --no-verify",
25-
"start:sample-map": "cd examples && npm run clean-examples && npm i && npm run start:map",
26-
"start:map-with-markers": "cd examples && npm run clean-examples && npm i && npm run start:map-markers",
27-
"start:geocoding-example": "cd examples && npm run clean-examples && npm i && npm run start:geocoding",
25+
"postinstall": "npm install --prefix examples",
26+
"start:sample-map": "cd examples && npm run clean-examples && npm run start:map",
27+
"start:map-with-markers": "cd examples && npm run clean-examples && npm run start:map-markers",
28+
"start:geocoding-example": "cd examples && npm run clean-examples && npm run start:geocoding",
2829
"start:places-example": "cd examples && npm run clean-examples && npm run start:places",
2930
"start:autocomplete-example": "cd examples && npm run clean-examples && npm run start:autocomplete",
3031
"start:directions-example": "cd examples && npm run clean-examples && npm run start:directions"

0 commit comments

Comments
 (0)