Skip to content

Commit 83fc8b7

Browse files
committed
build configs & semantic release
1 parent fb79c5e commit 83fc8b7

File tree

4 files changed

+149
-1
lines changed

4 files changed

+149
-1
lines changed

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [master, beta]
6+
7+
jobs:
8+
release:
9+
name: Release
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [12.x]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Cache NPM
24+
uses: actions/cache@v2
25+
env:
26+
cache-name: cache-npm
27+
with:
28+
path: ~/.npm
29+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn-lock.json') }}
30+
restore-keys: |
31+
${{ runner.os }}-build-${{ env.cache-name }}-
32+
- name: Setup Node.js ${{ matrix.node-version }}
33+
uses: actions/setup-node@v1
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
registry-url: 'https://npm.pkg.github.com'
37+
38+
- name: Install dependencies
39+
run: yarn install
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
43+
- name: Run linting
44+
run: yarn lint
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
48+
- name: Build project
49+
run: yarn build
50+
51+
- name: Release
52+
run: yarn release
53+
env:
54+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
57+
GIT_COMMIT: ${{ github.sha }}
58+
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
59+
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
60+
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
61+
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}

commitlint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
/**
3+
* Copyright 2020 Design Barn Inc.
4+
*/
5+
6+
module.exports = { extends: ['@commitlint/config-conventional'] };

package.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "1.0.1",
55
"description": "Lottie player wrapper for Vue.js by LottieFiles",
66
"scripts": {
7+
"release": "semantic-release",
78
"build": "vue-cli-service build --target lib --name @lottiefiles/vue-lottie-player ./src/index.js"
89
},
910
"main": "dist/@lottiefiles/vue-lottie-player.common.js",
@@ -37,7 +38,24 @@
3738
"@vue/compiler-sfc": "^3.0.11",
3839
"rollup": "^2.50.1",
3940
"rollup-plugin-vue": "^6.0.0",
40-
"vue-template-compiler": "^2.6.12"
41+
"vue-template-compiler": "^2.6.12",
42+
"@semantic-release/changelog": "^5.0.1",
43+
"@semantic-release/commit-analyzer": "^8.0.1",
44+
"@semantic-release/git": "^9.0.0",
45+
"@semantic-release/github": "^7.2.1",
46+
"@semantic-release/npm": "^7.1.1",
47+
"@semantic-release/release-notes-generator": "^9.0.2",
48+
"semantic-release": "^17.4.2",
49+
"husky": ">=4",
50+
"lint-staged": ">=10",
51+
"@commitlint/cli": "^12.1.1",
52+
"@commitlint/config-conventional": "^12.1.1"
53+
},
54+
"husky": {
55+
"hooks": {
56+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
57+
"pre-commit": "lint-staged"
58+
}
4159
},
4260
"keywords": [
4361
"vue",

release.config.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright 2020 Design Barn Inc.
3+
*/
4+
5+
'use strict';
6+
7+
const pkg = require('./package.json');
8+
9+
const CHANGELOG_HEADER = `# Changelog
10+
All notable changes to this project will be documented in this file.
11+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), enforced with [semantic-release](https://github.com/semantic-release/semantic-release).
12+
`;
13+
14+
const SUCCESS_COMMENT = `:tada: This \${issue.pull_request ? 'pull request is included' : 'issue is fixed'} in v\${nextRelease.version}, available on npm: [${pkg.name}@\${nextRelease.version}](https://www.npmjs.com/package/${pkg.name}).`;
15+
16+
/**
17+
* See:
18+
* https://semantic-release.gitbook.io/semantic-release/
19+
* https://github.com/semantic-release/npm
20+
* https://github.com/semantic-release/github
21+
* https://github.com/semantic-release/git
22+
* https://github.com/semantic-release/release-notes-generator
23+
* https://github.com/semantic-release/commit-analyzer
24+
* https://github.com/semantic-release/changelog
25+
*/
26+
module.exports = {
27+
branches: ['master', { name: 'beta', prerelease: true }],
28+
tagFormat: 'v${version}',
29+
ci: true,
30+
plugins: [
31+
[
32+
'@semantic-release/commit-analyzer',
33+
{
34+
preset: 'conventionalcommits',
35+
},
36+
],
37+
'@semantic-release/release-notes-generator',
38+
[
39+
'@semantic-release/changelog',
40+
{
41+
changelogFile: 'CHANGELOG.md',
42+
changelogTitle: CHANGELOG_HEADER,
43+
},
44+
],
45+
'@semantic-release/git',
46+
[
47+
'@semantic-release/github',
48+
{
49+
message: 'chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
50+
assets: 'dist/*.tgz',
51+
successComment: SUCCESS_COMMENT,
52+
addReleases: 'bottom',
53+
},
54+
],
55+
[
56+
'@semantic-release/npm',
57+
{
58+
npmPublish: true,
59+
tarballDir: 'dist',
60+
},
61+
],
62+
],
63+
};

0 commit comments

Comments
 (0)