Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/GitHub workflows #502

Merged
merged 5 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"extends": [
"plugin:react/recommended",
"prettier/@typescript-eslint",
"plugin:@typescript-eslint/recommended",
"prettier"
],
Expand Down Expand Up @@ -155,14 +154,7 @@
"no-undef": 0,
"no-undef-init": 2,
"no-undefined": 2,
"no-unused-vars": [
2,
{
"vars": "all",
"args": "after-used",
"varsIgnorePattern": "^I"
}
],
"no-unused-vars": [0],
"no-use-before-define": [0],
"@typescript-eslint/no-use-before-define": [2],
"callback-return": 2,
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- name: Checkout repository from GitHub
uses: actions/checkout@v3
- name: Setup npm
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test

deploy-example:
name: Deploy example to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout repository from GitHub
uses: actions/checkout@v3
- name: Setup npm
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Build example
run: npm run build:example
- name: Deploy to GitHub Pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/ubilabs/react-geosuggest.git
npm run publish:example -- -u "github-actions-bot <[email protected]>"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

publish-npm-package:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout repository from GitHub
uses: actions/checkout@v3
- name: Setup npm
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
# npm cache folder is in ~/, not within the working directory
- name: Cache npm directory
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install
- name: Build module
run: npm run build:module
- name: Run tests
run: npm run test
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOT_ACCESS_TOKEN }}
plumdumpling marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Tests

on:
push:
branches-ignore:
- main

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- name: Checkout repository from GitHub
uses: actions/checkout@v3
- name: Setup npm
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ test
.editorconfig
.eslintrc
.gitignore
.travis.yml
.prettierrc.yml
.prettierignore
rollup.browser.config.js
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
singleQuote: true
jsxBracketSameLine: true
bracketSameLine: true
bracketSpacing: false
trailingComma: none
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# React Geosuggest [![Build Status](https://travis-ci.org/ubilabs/react-geosuggest.svg?branch=master)](https://travis-ci.org/ubilabs/react-geosuggest)
# React Geosuggest

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.

Expand Down Expand Up @@ -349,7 +349,7 @@ Same effect as hitting `enter` (will geocode the text inside of the input).

```jsx
import React, {useRef} from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import Geosuggest from 'react-geosuggest';

const App = () => {
Expand Down Expand Up @@ -386,7 +386,9 @@ const App = () => {
);
};

ReactDOM.render(<App />, document.getElementById('app'));
const container = document.getElementById('app');
const root = ReactDOM.createRoot(container!);
root.render(<App />);
```

## Styling
Expand Down
Loading