Skip to content

Commit

Permalink
feat(ci): add package ci
Browse files Browse the repository at this point in the history
  • Loading branch information
gabin54 committed Jul 2, 2024
1 parent 43ddd66 commit 934d447
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: blue-reward-programs

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-build-and-test:
name: Lint, Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Lint SDK
run: yarn lint

- name: Build SDK
run: yarn build

- name: Test SDK
run: yarn test --coverage
release:
needs: [lint-build-and-test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/release.yml
secrets: inherit
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
workflow_call:
inputs:
node-version:
type: string
default: lts/*
secrets:
NPM_TOKEN:
required: true

jobs:
semantic-release:
runs-on: ubuntu-latest

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

- name: Setup Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: yarn

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build package
run: yarn build

- name: Publish package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
51 changes: 50 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,54 @@
},
"lint-staged": {
"*.ts": "prettier"
},
"release": {
"branches": [
"main",
"next"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "build",
"scope": "deps",
"release": "patch"
},
{
"release": "minor"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "build",
"section": "Dependencies and Other Build Updates",
"hidden": false
}
]
}
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
}
}
}

0 comments on commit 934d447

Please sign in to comment.