-
Notifications
You must be signed in to change notification settings - Fork 326
91 lines (86 loc) · 2.55 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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 }}