Skip to content

Commit

Permalink
feat: set up release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rafegoldberg committed Oct 25, 2021
1 parent 7aac9ab commit 95d195c
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
branches:
- main

jobs:
semantic-release:
name: Release
if: "!contains(github.event.head_commit.message, 'SKIP CI')"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [14.x]
steps:
- name: Checkout branch (${{ github.ref }})
uses: actions/checkout@master
- name: Configure git
run: |
git config user.name "Action"
git config user.email "[email protected]"
- name: Setup node (v${{ matrix.node-version }})
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: |
npm ci
npm run build --if-present
env:
CI: true
- name: Install release dependencies
# see: https://github.com/semantic-release/changelog/issues/168
run: npm i --no-save @semantic-release/changelog@5 @semantic-release/exec@5 @semantic-release/git@9
- name: Build release
run: npm run release
env:
GH_TOKEN: ${{ secrets.GITHUB_ADMIN || secrets.GITHUB_TOKEN }} # push release to remote repo
NPM_TOKEN: ${{ secrets.NPM_TOKEN || secrets.GITHUB_TOKEN }} # publish package to registry
- name: Sync to remote
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
continue-on-error: true
- name: Sync to next
if: "github.ref == 'refs/heads/master'"
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: next
continue-on-error: true
- name: Save bundle
uses: actions/upload-artifact@v1
with:
name: Bundle
path: dist
continue-on-error: true
74 changes: 74 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
module.exports = {
ci: false,
branches: ["master", { name: "next", prerelease: true }],
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "angular",
releaseRules: [
{ type: "feat", release: "minor" },
{ type: "style", release: "patch" },
{ type: "refactor", release: "patch" },
{ scope: "skip", release: false },
],
parserOpts: {
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"],
},
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "conventionalcommits",
presetConfig: {
types: [
{ type: "feat", section: "✨ New & Improved", hidden: false },
{ type: "refactor", section: "✨ New & Improved", hidden: true },

{ type: "style", section: "💄 Style Refinements", hidden: false },

{ type: "fix", section: "🛠 Fixes & Updates", hidden: false },
{ type: "perf", section: "🛠 Fixes & Updates", hidden: false },
{ type: "chore", section: "🛠 Fixes & Updates", hidden: true },
{ type: "test", section: "🛠 Fixes & Updates", hidden: true },

{ type: "docs", section: "📘 Docs", hidden: false },

{ type: "build", hidden: true },
{ type: "ci", hidden: true },
],
},
parserOpts: {
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"],
},
writerOpts: {
commitsSort: ["subject", "scope"],
headerPartial: `## Version {{version}}`,
},
},
],
[
"@semantic-release/changelog",
{
changelogTitle: "Changelog\n===",
},
],
[
"@semantic-release/npm",
{
npmPublish: false,
tarballDir: "dist",
},
],
["@semantic-release/github"],
[
"@semantic-release/git",
{
assets: ["CHANGELOG.md", "package.json", "package-lock.json"],
message:
"Release v${nextRelease.version}\n\n${nextRelease.notes}\n<!--SKIP CI-->",
},
],
],
};

0 comments on commit 95d195c

Please sign in to comment.