Skip to content

Commit

Permalink
ci: add semantic release setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nelson6e65 committed Oct 10, 2023
1 parent ae8e12b commit cea68c0
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Code Review

on:
# push:
# branches:
# - main

pull_request:
branches:
- main

workflow_dispatch:

workflow_call:

permissions:
contents: read # for checkout

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Linting types
run: npm run lint:ts

- name: Linting javascript
run: npm run lint:eslint

- name: Linting style
run: npm run lint:style

test:
name: Test
runs-on: ubuntu-latest
needs:
- lint
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm install

- name: Test
run: npm run test

- name: Build
run: npm run build
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release

on:
push:
branches:
- main

workflow_dispatch:

permissions:
contents: read # for checkout

jobs:
checks:
uses: ./.github/workflows/code-review.yml

release:
name: Release
runs-on: ubuntu-latest
needs:
- checks

permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_SEMANTIC_RELEASE }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
22 changes: 22 additions & 0 deletions release.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @type {import('semantic-release').GlobalConfig}
*/
module.exports = {
branches: [
{
name: 'main',
},
],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/npm',
[
'@semantic-release/github',
{
assignees: '@nelson6e65',
discussionCategoryName: 'announcements',
},
],
],
};

0 comments on commit cea68c0

Please sign in to comment.