Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

Commit d2c3eb1

Browse files
authored
Chore/GitHub workflows (#502)
* chore(dependencies): update all dependencies * chore(react-v18): switch to @testing-library/react for better react v18 support * docs(react-v18): use react v18 in README code examples * chore(travis): remove travis from project * chore(workflows): add Github actions for testing and release
1 parent fbabb6d commit d2c3eb1

6 files changed

Lines changed: 116 additions & 13 deletions

File tree

.github/workflows/release.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 8
13+
steps:
14+
- name: Checkout repository from GitHub
15+
uses: actions/checkout@v3
16+
- name: Setup npm
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '16'
20+
- name: Install dependencies
21+
run: npm install
22+
- name: Run tests
23+
run: npm run test
24+
25+
deploy-example:
26+
name: Deploy example to GitHub Pages
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout repository from GitHub
30+
uses: actions/checkout@v3
31+
- name: Setup npm
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: '16'
35+
- name: Install dependencies
36+
run: npm install
37+
- name: Build example
38+
run: npm run build:example
39+
- name: Deploy to GitHub Pages
40+
run: |
41+
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/ubilabs/react-geosuggest.git
42+
npm run publish:example -- -u "github-actions-bot <support+actions@github.com>"
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
create-release:
47+
name: Create Release
48+
runs-on: ubuntu-latest
49+
outputs:
50+
upload_url: ${{ steps.create_release.outputs.upload_url }}
51+
steps:
52+
- name: Create Release
53+
id: create_release
54+
uses: actions/create-release@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
tag_name: ${{ github.ref }}
59+
release_name: Release ${{ github.ref }}
60+
draft: false
61+
prerelease: false
62+
63+
publish-npm-package:
64+
name: Publish to NPM
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout repository from GitHub
68+
uses: actions/checkout@v3
69+
- name: Setup npm
70+
uses: actions/setup-node@v3
71+
with:
72+
node-version: '16'
73+
registry-url: 'https://registry.npmjs.org'
74+
# npm cache folder is in ~/, not within the working directory
75+
- name: Cache npm directory
76+
uses: actions/cache@v3
77+
with:
78+
path: ~/.npm
79+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
80+
restore-keys: |
81+
${{ runner.os }}-node-
82+
- name: Install dependencies
83+
run: npm install
84+
- name: Build module
85+
run: npm run build:module
86+
- name: Run tests
87+
run: npm run test
88+
- name: Publish
89+
run: npm publish --access public
90+
env:
91+
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOT_ACCESS_TOKEN }}

.github/workflows/test.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 8
13+
steps:
14+
- name: Checkout repository from GitHub
15+
uses: actions/checkout@v3
16+
- name: Setup npm
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '16'
20+
- name: Install dependencies
21+
run: npm install
22+
- name: Run tests
23+
run: npm run test

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ test
77
.editorconfig
88
.eslintrc
99
.gitignore
10-
.travis.yml
1110
.prettierrc.yml
1211
.prettierignore
1312
rollup.browser.config.js

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# React Geosuggest [![Build Status](https://travis-ci.org/ubilabs/react-geosuggest.svg?branch=master)](https://travis-ci.org/ubilabs/react-geosuggest)
1+
# React Geosuggest
22

33
A [React](https://reactjs.org/) autosuggest for the Google Maps Places API. You can also define your own suggests as defaults. Works with [Preact](https://github.com/developit/preact), too.
44

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"preversion": "npm test",
8989
"version": "npm run build:browser && npm run changelog && git add .",
9090
"postversion": "git push && git push --tags && npm run publish:example",
91-
"publish:example": "npm run build:example && gh-pages -d example/dist"
91+
"publish:example": "gh-pages -d example/dist"
9292
},
9393
"readmeFilename": "README.md",
9494
"keywords": [

0 commit comments

Comments
 (0)