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 781c292 commit dd67a3d
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 24 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/lint.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test & Maybe Release
on: [push, pull_request]
jobs:
test:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: [12, 14, 16]
# windows support not quite ready: os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]

steps:
- name: Clone repository
uses: actions/checkout@v2

- run: git fetch --prune --unshallow

- name: Set Node.js version
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- run: node --version
- run: npm --version
- run: git --version

- name: Install npm dependencies
run: npm ci

- name: Run tests
run: npm test

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

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
84 changes: 83 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"scripts": {
"lint": "standard",
"format": "standard --fix"
"format": "standard --fix",
"test": "npm run lint"
},
"author": "Rod <rod@vagg.org> (http://r.va.gg/)",
"license": "MIT",
Expand All @@ -33,5 +34,86 @@
"preferGlobal": true,
"devDependencies": {
"standard": "^16.0.3"
},
"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 dd67a3d

Please sign in to comment.