Skip to content

Commit

Permalink
ci: add semantic-pull-request and release-and-publish gh actions (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
inigomarquinez authored Jun 13, 2023
1 parent 805849e commit db04785
Show file tree
Hide file tree
Showing 9 changed files with 2,397 additions and 2,717 deletions.
34 changes: 0 additions & 34 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/npm-publish.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release and publish

on:
push:
branches:
- main

permissions: {}

jobs:
release-please:
permissions:
contents: write # to create release commit
pull-requests: write # to create release PR

runs-on: ubuntu-latest

outputs:
release_created: ${{ steps.release.outputs.release_created }}

steps:
- name: Create or update release
uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: '@onebeyond/license-checker'
changelog-types: '[{ "type": "feat", "section": "🆕 Features", "hidden": false },{ "type": "fix", "section": "🐛 Bug Fixes", "hidden": false },{ "type": "chore", "section": "🔧 Others", "hidden": false },{ "type": "docs", "section": "📝 Docs", "hidden": false },{ "type": "style", "section": "🎨 Styling", "hidden": false },{ "type": "refactor", "section": "🔄 Code Refactoring", "hidden": false },{ "type": "perf", "section": "📈 Performance Improvements", "hidden": false },{ "type": "test", "section": "🔬 Tests", "hidden": false },{ "type": "ci", "section": "☁️ CI", "hidden": false }]'
release-as: '1.0.0'

npm-publish:
runs-on: ubuntu-latest

needs: [release-please]

# this if statements ensure that a publication only occurs when a new release is created:
if: ${{ needs.release-please.outputs.release_created }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci --production

- name: Publish to npm
run: npm publish --ignore-scripts --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GUIDESMITHS }}
20 changes: 13 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ jobs:
timeout-minutes: 15
steps:
- name: Check-out the repository
uses: actions/checkout@v2
- name: Setup node version 16.13.0 (LTS)
uses: actions/setup-node@v2
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.13.0'
node-version: 16
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run lint
- run: npm run test

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Run tests
run: npm run test
31 changes: 31 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: semantic pull request

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
lint:
name: Validate Pull Request title format
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure additional validation for the subject based on a regex.
# This ensures the subject doesn't start with an uppercase character.
subjectPattern: ^(?![A-Z]).+$
# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
5 changes: 5 additions & 0 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"format": "group",
"interactive": true,
"peer": true
}
Loading

0 comments on commit db04785

Please sign in to comment.