-
Notifications
You must be signed in to change notification settings - Fork 11.9k
92 lines (87 loc) · 2.95 KB
/
release.yml
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
92
# This manually triggered job sets the version of package, drafts release notes, publishes package to NPM, deploys docs and attaches the builds assets to the release tag.
# The required input 'version' can be anything `npm version` supports:
# > npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'version'
default: 'patch'
required: true
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Bump version
id: version
run: |
git config --global user.email "$GITHUB_AUTH_EMAIL"
git config --global user.name "Chart.js"
ouput=$(npm version ${version})
echo "::set-output name=version::$output"
env:
version: ${{ github.event.inputs.version }}
- name: Push
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
notes:
needs: version
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.draft.outputs.upload_url }}
steps:
- name: Draft release notes
id: draft
uses: release-drafter/release-drafter@v5
with:
version: ${{ needs.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [version, notes]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Setup and build
run: |
npm ci
npm run build
./scripts/docs-config.sh "${VERSION}"
npm run docs
npm run typedoc
npm pack
env:
VERSION: ${{ needs.version.outputs.version }}
- name: Publish to NPM
run: ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
VERSION: ${{ needs.version.outputs.version }}
- name: Deploy Docs
run: ./scripts/deploy-docs.sh "$VERSION"
env:
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
GH_AUTH_EMAIL: ${{ secrets.GH_AUTH_EMAIL }}
VERSION: ${{ needs.version.outputs.version }}
- name: Upload NPM package file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.version.outputs.version }}
with:
upload_url: ${{ needs.notes.outputs.upload_url }}
asset_path: ${{ format('chart.js-{0}.tgz', needs.version.outputs.version) }}
asset_name: ${{ format('chart.js-{0}.tgz', needs.version.outputs.version) }}
asset_content_type: application/gzip