forked from jaime-olivares/vscode-yuml
-
Notifications
You must be signed in to change notification settings - Fork 5
51 lines (49 loc) · 1.86 KB
/
Copy pathrelease.yml
File metadata and controls
51 lines (49 loc) · 1.86 KB
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
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: "https://registry.npmjs.org"
always-auth: true
- name: Install GH Actions toolkit
run: npm install @actions/core --no-save
- name: Read release info
run: >
node -e 'const core = require("@actions/core"); const { join } =
require("path"); const { readFileSync } = require("fs"); const {
version } = require(join(process.env.GITHUB_WORKSPACE,
"package.json")); const tag = version.match(/alpha|beta|rc/); const [,
changes] = readFileSync(join(process.env.GITHUB_WORKSPACE,
"CHANGELOG.md"), "utf8").split("\n## "); core.setOutput("VERSION",
version); core.setOutput("RELEASE_NOTES",
changes.substring(changes.indexOf("\n")));
core.setOutput("IS_PRE_RELEASE", !!tag); core.setOutput("NPM_FLAGS",
tag ? `--tag ${tag[0]}` : "")'
id: release_info
- 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 }}
body: ${{ steps.release_info.outputs.RELEASE_NOTES }}
draft: false
prerelease: ${{ steps.release_info.outputs.IS_PRE_RELEASE }}
- name: Publish to NPM
id: publish
run: npm publish ${{ steps.release_info.outputs.NPM_FLAGS }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}