Skip to content

Commit

Permalink
feat: Add semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbo2002 committed Nov 13, 2020
1 parent aae4040 commit 2ff70d6
Show file tree
Hide file tree
Showing 6 changed files with 6,062 additions and 164 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Release
on:
push:
branches:
- develop
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 10, 12, 14, 15 ]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/cache@v1
id: pip-cache
with:
path: ~/.cache/pip
key: pip
- run: pip install pyatv
- uses: actions/cache@v2
id: module-cache
with:
path: node_modules
key: modules-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
- name: install dependencies
if: steps.module-cache.outputs.cache-hit != 'true'
run: npm ci
- name: test
run: npm run test || npm run test

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/cache@v2
id: module-cache
with:
path: node_modules
key: modules-14-${{ hashFiles('**/package-lock.json') }}
- name: npm ci
if: steps.module-cache.outputs.cache-hit != 'true'
run: npm ci
- run: npm run lint

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/cache@v1
id: pip-cache
with:
path: ~/.cache/pip
key: pip
- run: pip install pyatv
- uses: actions/cache@v2
id: module-cache
with:
path: node_modules
key: modules-14-${{ hashFiles('**/package-lock.json') }}
- name: install dependencies
if: steps.module-cache.outputs.cache-hit != 'true'
run: npm ci
- run: npm run coverage || npm run coverage

release:
runs-on: ubuntu-latest
needs: [ test, lint, coverage]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- uses: actions/cache@v2
id: module-cache
with:
path: node_modules
key: modules-14-${{ hashFiles('**/package-lock.json') }}
- name: install dependencies
if: steps.module-cache.outputs.cache-hit != 'true'
run: npm ci
- name: semantic-release
run: npx semantic-release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,20 @@ jobs:
if: steps.module-cache.outputs.cache-hit != 'true'
run: npm ci
- run: npm run coverage || npm run coverage

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/cache@v2
id: module-cache
with:
path: node_modules
key: modules-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
- name: install dependencies
if: steps.module-cache.outputs.cache-hit != 'true'
run: npm ci
- run: npm run build
6 changes: 3 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
/ical-generator.sublime-workspace
/ical-generator.sublime-project
/node_modules/
/test-result/
/dist
/coverage
/.idea/
/.nyc_output
/test-result
42 changes: 42 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"branches": [
"main",
{
"name": "develop",
"channel": "next",
"prerelease": true
}
],
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{"type": "refactor", "release": "patch"},
{"type": "style", "release": "patch"},
{"type": "build", "scope": "deps", "release": "patch"}
],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
}
}],
["@semantic-release/release-notes-generator", {
"preset": "angular",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
},
"writerOpts": {
"commitsSort": ["subject", "scope"]
}
}],
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
"@semantic-release/npm",
"semantic-release-npm-deprecate-old-versions",
"@semantic-release/github",
["@semantic-release/git", {
"assets": ["CHANGELOG.md", "package.json"],
"message": "chore(release): :bookmark: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}]
]
}
Loading

0 comments on commit 2ff70d6

Please sign in to comment.