-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(workflows): add Github actions for testing and release
- Loading branch information
1 parent
7799c6f
commit 86ba04e
Showing
3 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters