Skip to content

Commit

Permalink
ci: fix a few things, using lerna!
Browse files Browse the repository at this point in the history
  • Loading branch information
joonaathaan committed Oct 18, 2024
1 parent 1e2e53d commit 7cfa791
Show file tree
Hide file tree
Showing 10 changed files with 2,853 additions and 1,369 deletions.
51 changes: 24 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Stable
name: Release

on:
push:
Expand All @@ -8,15 +8,6 @@ on:

jobs:
publish:
strategy:
fail-fast: false
matrix:
include:
- package: '@lasfoiawbp/test1'
folder: 'packages/test1'
- package: '@lasfoiawbp/test2'
folder: 'packages/test2'

runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -41,24 +32,30 @@ jobs:
run: pnpm install

- name: Build Project
run: pnpm --filter $${{ matrix.package }} build
run: pnpm lerna run build

- name: Publish stable release
if: ${{ github.ref_name }} == 'stable'
run: |
pnpm lerna version --conventional-commits --conventional-graduate --amend --create-release github --yes
pnpm lerna publish from-package --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Publish package
id: release
- name: Publish devlopement release
if: ${{ github.ref_name }} != 'stable'
run: |
pnpm lerna version --conventional-commits --conventional-prerelease --amend --preid dev --yes
pnpm lerna publish from-package --yes
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Set up git user, commit and push!
run: |
cd ${{ matrix.folder }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if [[ "${{ github.ref_name }}" == "stable" ]]; then
pnpm dlx @favware/cliff-jumper \
--name "${{ matrix.package }}" \
--package-path "${{ matrix.folder }}"
else
pnpm dlx @favware/cliff-jumper \
--name "${{ matrix.package }}" \
--package-path "${{ matrix.folder }}"
--preid dev
fi
pnpm publish --provenance --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
git add .
git commit -m "chore: publish packages [skip ci]" || echo "No changes to commit"
git push
21 changes: 21 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"npmClient": "pnpm",
"packages": [
"packages/*"
],
"version": "independent",
"command": {
"publish": {
"npmClient": "pnpm",
"allowBranch": [
"main",
"stable"
],
"registry": "https://registry.npmjs.org/"
},
"version": {
"npmClient": "pnpm"
}
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"license": "ISC",
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0"
"@commitlint/config-conventional": "^19.5.0",
"@favware/npm-deprecate": "^1.0.7",
"lerna": "^8.1.8"
}
}
83 changes: 0 additions & 83 deletions packages/test1/cliff.toml

This file was deleted.

8 changes: 0 additions & 8 deletions packages/test1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,9 @@
"url": "https://github.com/joonaathaan/lasfoiawbp/issues"
},
"homepage": "https://github.com/joonaathaan/lasfoiawbp#readme",
"scripts": {
"build": "echo 'Build step skipped'"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@favware/npm-deprecate": "^1.0.7",
"@semantic-release/changelog": "^6.0.3",
"semantic-release": "^24.1.2"
},
"publishConfig": {
"access": "public",
"provenance": true
Expand Down
77 changes: 0 additions & 77 deletions packages/test1/release.config.cjs

This file was deleted.

83 changes: 0 additions & 83 deletions packages/test2/cliff.toml

This file was deleted.

9 changes: 1 addition & 8 deletions packages/test2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@
"url": "https://github.com/joonaathaan/lasfoiawbp/issues"
},
"homepage": "https://github.com/joonaathaan/lasfoiawbp#readme",
"scripts": {
"build": "echo 'Build step skipped'"
},
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@favware/npm-deprecate": "^1.0.7",
"@semantic-release/changelog": "^6.0.3",
"semantic-release": "^24.1.2"
},
"dependencies": {
"@lasfoiawbp/test1": "workspace:^"
},
Expand Down
Loading

0 comments on commit 7cfa791

Please sign in to comment.