Skip to content

Commit 3882f49

Browse files
authored
add workflows to release package (#1)
1 parent 4de5cd8 commit 3882f49

File tree

5 files changed

+127
-36
lines changed

5 files changed

+127
-36
lines changed

.drone.yml

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

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on: pull_request
4+
5+
jobs:
6+
check:
7+
name: Automated checks
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Setup environment
14+
uses: actions/setup-node@v3.1.1
15+
with:
16+
node-version: '16'
17+
18+
- name: Install dependencies
19+
run: yarn install --immutable
20+
21+
- name: Lint files
22+
run: yarn lint
23+
24+
- name: Run tests
25+
run: yarn test:ci
26+
27+
- name: Run build
28+
run: yarn build
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
name: Create Release
7+
8+
jobs:
9+
publish:
10+
name: Publish to npm
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Setup environment
16+
uses: actions/setup-node@v2.5.1
17+
with:
18+
node-version: '16'
19+
registry-url: 'https://registry.npmjs.org'
20+
cache: 'yarn'
21+
22+
- name: Install dependencies
23+
run: yarn install --immutable
24+
25+
- name: Build package
26+
run: yarn build
27+
28+
- name: Publish
29+
run: npm publish --access public
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
33+
create-github-release:
34+
name: Create GitHub Release
35+
runs-on: ubuntu-latest
36+
needs: publish
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v2
40+
41+
- name: Create Release Notes
42+
uses: actions/github-script@v6.2.0
43+
with:
44+
github-token: ${{secrets.GITHUB_TOKEN}}
45+
script: |
46+
await github.request(`POST /repos/${{ github.repository }}/releases`, {
47+
tag_name: "${{ github.ref }}",
48+
generate_release_notes: true
49+
});
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: NPM bump version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Semver type of new version (major / minor / patch)'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
15+
jobs:
16+
bump-version:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
23+
24+
- name: Setup environment
25+
uses: actions/setup-node@v2.5.1
26+
with:
27+
node-version: '16'
28+
cache: 'yarn'
29+
30+
- name: Install dependencies
31+
run: yarn install --immutable
32+
33+
- name: Build package
34+
run: yarn build
35+
36+
- name: Run tests
37+
run: yarn test:ci
38+
39+
- name: Setup Git
40+
run: |
41+
git config user.name 'grafanabot'
42+
git config user.email 'bot@grafana.com'
43+
- name: bump version
44+
run: npm version ${{ github.event.inputs.version }}
45+
46+
- name: Push latest version
47+
run: git push origin main --follow-tags

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
"build": "yarn clean && yarn typecheck && yarn bundle",
99
"bundle": "rollup -c rollup.config.ts",
1010
"clean": "rimraf ./dist ./compiled",
11+
"lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx ./src",
1112
"typecheck": "tsc -p ./tsconfig.build.json",
1213
"test": "jest --notify --watch",
13-
"test:coverage": "jest --coverage",
14-
"test-ci": "grafana-toolkit plugin:test"
14+
"test:ci": "jest",
15+
"test:coverage": "jest --coverage"
1516
},
1617
"publishConfig": {
1718
"main": "dist/index.js",

0 commit comments

Comments
 (0)