Skip to content

Commit

Permalink
chore: add auto-release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Oct 14, 2021
1 parent ed6ff3b commit 36ca9e5
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Tests

name: Test & Maybe Release
on: [push, pull_request]

jobs:
run:
test:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -47,3 +45,46 @@ jobs:

- name: Run tests
run: npm test

release:
name: Release
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'

steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2.4.0
with:
node-version: 14

- name: Install dependencies
run: |
npm install --no-progress --no-package-lock --no-save
- name: Build
run: |
npm run build
- name: Install plugins
run: |
npm install \
@semantic-release/commit-analyzer \
conventional-changelog-conventionalcommits \
@semantic-release/release-notes-generator \
@semantic-release/npm \
@semantic-release/github \
@semantic-release/git \
@semantic-release/changelog \
--no-progress --no-package-lock --no-save
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
81 changes: 81 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,86 @@
"lint": "standard",
"unit": "tap --no-check-coverage test.js",
"test": "npm run lint && npm run unit"
},
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Trivial Changes"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
}
}

0 comments on commit 36ca9e5

Please sign in to comment.