Skip to content

Commit

Permalink
feat: first release
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-aveiro committed Feb 7, 2024
1 parent 290f221 commit 0acad6a
Show file tree
Hide file tree
Showing 10 changed files with 601 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/configs/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { maxLineLength } = require('@commitlint/ensure')

const bodyMaxLineLength = 100

const validateBodyMaxLengthIgnoringDeps = (parsedCommit) => {
const { type, scope, body } = parsedCommit
const isDepsCommit =
type === 'chore' && scope === 'release'

return [
isDepsCommit || !body || maxLineLength(body, bodyMaxLineLength),
`body's lines must not be longer than ${bodyMaxLineLength}`,
]
}

module.exports = {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
'body-max-line-length': [0],
'function-rules/body-max-line-length': [
2,
'always',
validateBodyMaxLengthIgnoringDeps,
],
},
}
16 changes: 16 additions & 0 deletions .github/workflows/checks.base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Checks (base)

on:
workflow_call:

jobs:
commitlint:
name: (check) Commitlint
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run Commitlint
uses: wagoid/commitlint-github-action@v5
with:
configFile: .github/configs/commitlint.config.js
11 changes: 11 additions & 0 deletions .github/workflows/checks.branches.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Checks (branches)

on:
push:
branches-ignore:
- main
- staging

jobs:
checks:
uses: ./.github/workflows/checks.base.yaml
46 changes: 46 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release
run-name: "Release `${{ github.ref_name }}` (SHA: ${{ github.sha }})"

on:
push:
branches:
- main
- staging

permissions:
contents: read

jobs:
checks:
name: Run Checks
uses: ./.github/workflows/checks.base.yaml
release:
name: Release
needs: checks
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Install plugins
run: >
npm install -D
@semantic-release/git
@semantic-release/changelog
conventional-changelog-conventionalcommits
@saithodev/semantic-release-backmerge
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
103 changes: 103 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Dependency directory
node_modules

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*

# IDE files
.idea
.vscode
*.code-workspace
129 changes: 129 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
preset: conventionalcommits
tagFormat: "${version}"

branches:
- "+([0-9])?(.{+([0-9]),x}).x"
- main
- next
- next-major
- name: staging
prerelease: rc
- name: beta
prerelease: true
- name: alpha
prerelease: true

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- "@semantic-release/git"
- "@semantic-release/github"
- "@saithodev/semantic-release-backmerge"

verifyConditions:
- "@semantic-release/changelog"
- "@semantic-release/git"
- "@semantic-release/github"
- path: "@saithodev/semantic-release-backmerge"
backmergeBranches:
- from: main
to: staging

analyzeCommits:
- path: "@semantic-release/commit-analyzer"
releaseRules:
- breaking: true
release: major
- type: build
release: patch
- type: chore
release: false
- type: ci
release: false
- type: docs
release: patch
- type: feat
release: minor
- type: fix
release: patch
- type: perf
release: patch
- type: refactor
release: false
- type: revert
release: patch
- type: style
release: false
- type: test
release: false

generateNotes:
- path: "@semantic-release/release-notes-generator"
writerOpts:
groupBy: type
commitGroupsSort: title
commitsSort: header
linkCompare: true
linkReferences: true
presetConfig:
types:
- type: build
section: "🦊 CI/CD"
hidden: false
- type: chore
section: "Other"
hidden: true
- type: ci
section: "🦊 CI/CD"
hidden: false
- type: docs
section: "📔 Docs"
hidden: false
- type: example
section: "📝 Examples"
hidden: true
- type: feat
section: "🚀 Features"
hidden: false
- type: fix
section: "🛠 Fixes"
hidden: false
- type: perf
section: "⏩ Performance"
hidden: false
- type: refactor
section: ":scissors: Refactor"
hidden: false
- type: revert
section: "🙅‍♂️ Reverts"
hidden: false
- type: style
section: "💈 Style"
hidden: false
- type: test
section: "🧪 Tests"
hidden: false

prepare:
- path: "@semantic-release/changelog"
changelogFile: CHANGELOG.md

- path: "@semantic-release/git"
message: "chore(release): release <%= nextRelease.version %> - <%= new Date().toLocaleDateString('en-US', {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' }) %> \n\n<%= nextRelease.notes %>"
assets:
- CHANGELOG.md
- pyproject.toml

publish:
- path: "@semantic-release/github"

success:
- path: "@semantic-release/github"
- path: "@saithodev/semantic-release-backmerge"
backmergeBranches:
- from: main
to: staging

fail:
- path: "@semantic-release/github"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Ethiack, Lda.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 0acad6a

Please sign in to comment.