Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tune ci #649

Merged
merged 8 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ module.exports = {
'plugins',
'integration',
'doc',
'release',
'.commitlint'
],
],
'scope-empty': [2, 'never'],
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
name: Node.js CI

on: push

jobs:
build:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
Expand All @@ -21,6 +18,6 @@ jobs:

- name: Run lint
run: npm run lint

- name: Run tests
run: npm run test --silent
27 changes: 0 additions & 27 deletions .github/workflows/npm-publish-ci.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/release-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release commit
on:
release:
types: [published]
jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm test

create-release-commit:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: master

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

- name: Install dependencies
run: npm ci

- name: Initalize git user email
run: git config --global user.email "${{vars.RELEASE_USER_EMAIL}}"
- name: Initalize git user name
run: git config --global user.name "Release commit workflow"

- name: Init release commit
run: npm run release -- --ci ${{github.event.release.tag_name}}
env:
GITHUB_TOKEN: ${{secrets.github_token}}
56 changes: 56 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release publish NPM
on:
push:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
# - run: npm test
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: master
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci
- name: Initalize git user email
run: git config --global user.email "${{env.RELEASE_USER_EMAIL}}"
- name: Initalize git user name
run: git config --global user.name "Release publish workflow"

- name: Initialize npm config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Check if release is a pre-release
id: check_pre_release
run: echo "{name}=${{github.event.release.prerelease}}" >> $GITHUB_OUTPUT

- name: Publish to npm
if: steps.check_pre_release.outputs.is_pre_release == 'true'
run: npm publish --tag beta
env:
GITHUB_TOKEN: ${{secrets.github_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Publish to npm
if: steps.check_pre_release.outputs.is_pre_release != 'true'
run: npm publish
env:
GITHUB_TOKEN: ${{secrets.github_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
18 changes: 18 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"git": {
"requireBranch": false,
"requireUpstream": true,
"commit": true,
"commitMessage": "chore(release): v${version} ✨",
"push": true,
"pushArgs": ["--follow-tags"],
"tag": false
},
"github": {
"tokenRef": "GITHUB_TOKEN",
"preRelease": true
},
"npm": {
"publish": false
}
}
Loading