Skip to content

Commit

Permalink
Merge branch 'alpha' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninerian committed Nov 12, 2024
2 parents a2df8e3 + 0f7b503 commit 302f209
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 44 deletions.
51 changes: 33 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ name: Continuous Integration

on: [push, pull_request]

env:
GITHUB_TOKEN: ${{ secrets.STAFFBOT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
permissions:
contents: write # we need to read secrets

jobs:
test:
name: Build and Test
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand All @@ -30,10 +29,12 @@ jobs:
- name: Unit test
run: yarn jest --coverage


release:
name: Release
needs: test
runs-on: ubuntu-20.04
permissions: write-all
runs-on: ubuntu-22.04
steps:
- name: Obtain App Token
uses: actions/create-github-app-token@v1.10.3
Expand All @@ -44,29 +45,43 @@ jobs:

- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
token: ${{ steps.get_token.outputs.token }}
ref: ${{ github.head_ref }}

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 20.x
registry-url: 'https://npm.pkg.github.com'
scope: '@staffbase'

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

- name: Build
run: yarn build

- name: Remove NPM publish
if: ${{ github.ref == 'refs/heads/alpha' }}
run: "sed -i '/public:/d' .releaserc"

- name: Release
run: yarn semantic-release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
semantic_version: 23.0.0
extra_plugins: |
conventional-changelog-conventionalcommits
env:
GITHUB_NPM_CONFIG_REGISTRY: https://npm.pkg.github.com/
GITHUB_NPM_TOKEN: ${{ secrets.STAFFBOT_NPM_WRITE }}
NODE_AUTH_TOKEN: ${{ secrets.STAFFBOT_NPM_WRITE }}
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
PUBLIC_NPM_CONFIG_REGISTRY: https://registry.npmjs.org
PUBLIC_NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- uses: actions/setup-node@v4
if: steps.semantic.outputs.new_release_published == 'true'
with:
node-version: 20.x
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
scope: '@staffbase'

- name: Publish to NPM
if: steps.semantic.outputs.new_release_published == 'true' && github.ref != 'refs/heads/alpha'
run: |
npm publish --registry=https://registry.npmjs.org --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 0 additions & 5 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

[ -n "$CI" ] && exit 0

npx --no-install commitlint --edit "$1"
16 changes: 1 addition & 15 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

tagFormat: ${version}
debug: true
dryRun: false
extends: '@tmware/semantic-release-npm-github-publish'
plugins:
- - '@semantic-release/commit-analyzer'
- releaseRules:
Expand All @@ -23,17 +21,5 @@ plugins:

- '@semantic-release/release-notes-generator'
- '@semantic-release/changelog'
- - '@amanda-mitchell/semantic-release-npm-multiple'
- registries:
github: {}
public: {}
- - '@semantic-release/git'
- assets:
- package.json
- package-lock.json
- CHANGELOG.md
message: |-
release(version): Release ${nextRelease.version} [skip ci]

${nextRelease.notes}
- '@semantic-release/npm'
- '@semantic-release/github'
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@
"scripts": {
"build": "rollup -c",
"prebuild": "yarn run lint",
"prepare": "husky install",
"prepare": "husky",
"dev": "rollup -c rollup.dev.mjs -w",
"test-unit": "jest",
"test-dev": "jest --watch",
"lint": "yarn run lint-code && yarn run lint-size",
"lint-code": "yarn eslint src test",
"lint-size": "yarn size-limit",
"fix": "eslint --fix 'src/**/*.js' 'test/**/*.js'",
"doc": "mkdir -p doc && yarn --silent jsdoc2md src/main.js > doc/api.md",
"release": "semantic-release"
"doc": "mkdir -p doc && yarn --silent jsdoc2md src/main.js > doc/api.md"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Staffbase/plugins-client-sdk.git"
},
"repository": "https://github.com/Staffbase/plugins-client-sdk.git",
"keywords": [
"staffbase",
"client",
Expand Down Expand Up @@ -56,7 +58,6 @@
"object.entries-ponyfill": "1.0.1"
},
"devDependencies": {
"@amanda-mitchell/semantic-release-npm-multiple": "3.9.0",
"@babel/core": "7.24.7",
"@babel/plugin-transform-runtime": "7.24.7",
"@babel/preset-env": "^7.20.2",
Expand All @@ -70,7 +71,6 @@
"@rollup/plugin-strip": "3.0.4",
"@rollup/plugin-terser": "^0.4.0",
"@size-limit/preset-small-lib": "8.2.4",
"@tmware/semantic-release-npm-github-publish": "^1.5.5",
"babel-jest": "29.7.0",
"babel-plugin-istanbul": "^6.1.1",
"compare-versions": "^5.0.3",
Expand Down

0 comments on commit 302f209

Please sign in to comment.