Workflow file for this run
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
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 }} |