Skip to content

Commit bd5de1f

Browse files
committed
chore: fix release workflow
1 parent e81c9b9 commit bd5de1f

18 files changed

+107
-157
lines changed

.github/workflows/ci.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint
1+
name: CI
22
on:
33
pull_request:
44
branches:
@@ -8,9 +8,11 @@ on:
88
- main
99

1010
jobs:
11-
build-and-release:
11+
release:
1212
name: Release
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
1416
steps:
1517
- uses: actions/checkout@v4
1618
with:
@@ -28,16 +30,14 @@ jobs:
2830
- run: pnpm install --frozen-lockfile
2931
- name: Authenticate with Registry
3032
run: |
31-
echo "registry=http://registry.npmjs.org/" >> .npmrc
32-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
33+
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
3334
npm whoami
3435
env:
3536
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36-
- name: build
37-
run: pnpm build
3837
- name: release package
3938
if: ${{ success() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
40-
run: pnpm release --dry-run
39+
run: pnpm release --npm.skipChecks --increment 1.0.0
4140
env:
4241
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
# FRSOURCE Tooling
1+
# FRSOURCE Toolkit
22

3-
A repository that holds configuration files for tooling used throughout the FRSOURCE organization.
3+
A repository that holds shared toolkit used throughout the FRSOURCE organization:
4+
5+
- configuration files,
6+
- GitHub Actions scripts.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
const { name } = require("package.json");
12
const { monorepoIndependent } = require("@frsource/release-it-config");
23

34
module.exports = monorepoIndependent({
4-
name: "eslint-config",
5+
pkgName: name,
56
buildCmd: "", // no build needed
67
});
File renamed without changes.

packages/eslint/package.json packages/eslint-config/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@frsource/eslint-config",
3-
"version": "1.0.0",
3+
"version": "0.0.0",
44
"main": "index.mjs",
55
"type": "module",
66
"scripts": {
@@ -18,13 +18,14 @@
1818
"peerDependencies": {
1919
"eslint": ">= 9"
2020
},
21-
"homepage": "https://github.com/FRSOURCE/tooling/",
21+
"homepage": "https://github.com/FRSOURCE/toolkit/",
2222
"repository": {
2323
"type": "git",
24-
"url": "git+https://github.com/FRSOURCE/tooling.git"
24+
"url": "git+https://github.com/FRSOURCE/toolkit.git",
25+
"directory": "packages/eslint"
2526
},
2627
"bugs": {
27-
"url": "https://github.com/FRSOURCE/tooling/issues"
28+
"url": "https://github.com/FRSOURCE/toolkit/issues"
2829
},
2930
"author": "Jakub Freisler <[email protected]>",
3031
"license": "MIT",
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
const { name } = require("package.json");
12
const { monorepoIndependent } = require("@frsource/release-it-config");
23

34
module.exports = monorepoIndependent({
4-
name: "prettier-config",
5+
pkgName: name,
56
buildCmd: "", // no build needed
67
});
File renamed without changes.

packages/prettier/package.json packages/prettier-config/package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@frsource/prettier-config",
3-
"version": "1.0.0",
3+
"version": "0.0.0",
44
"main": "index.mjs",
55
"type": "module",
66
"scripts": {
@@ -18,13 +18,14 @@
1818
"peerDependencies": {
1919
"eslint": ">= 9"
2020
},
21-
"homepage": "https://github.com/FRSOURCE/tooling/",
21+
"homepage": "https://github.com/FRSOURCE/toolkit/",
2222
"repository": {
2323
"type": "git",
24-
"url": "git+https://github.com/FRSOURCE/tooling.git"
24+
"url": "git+https://github.com/FRSOURCE/toolkit.git",
25+
"directory": "packages/prettier-config"
2526
},
2627
"bugs": {
27-
"url": "https://github.com/FRSOURCE/tooling/issues"
28+
"url": "https://github.com/FRSOURCE/toolkit/issues"
2829
},
2930
"author": "Jakub Freisler <[email protected]>",
3031
"license": "MIT",
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
const { name } = require("package.json");
12
const { monorepoIndependent } = require("./index.cjs");
23

34
module.exports = monorepoIndependent({
4-
name: "release-it",
5+
pkgName: name,
56
buildCmd: "", // no build needed
67
});
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const nodePath = require("path");
2+
3+
/**
4+
* Configuration for independent package in monorepo workspace
5+
* @param {Object} options
6+
* @param {string} options.pkgName name of the package in the monorepo, e.g. `@frsource/my-package`
7+
* @param {string} [options.path=`packages/${options.pkgName}`] path of the package relative to the monorepo root, without starting slash. Always use "/" as delimiter. Will default to `packages/${options.pkgName}` (package scope in `options.pkgName` will be omitted)
8+
* @param {string} [options.buildCmd="pnpm build"] command that should be used to build the package, defaults to `pnpm build`
9+
*/
10+
module.exports = ({
11+
pkgName,
12+
path = `packages/${pkgName.substring(pkgName.lastIndexOf("/") + 1)}`,
13+
buildCmd = "pnpm build",
14+
}) => {
15+
if (path.startsWith("/")) path = path.substring(1);
16+
const nestingLevel = path.split("/").length;
17+
if (nodePath.sep !== "/") path = path.replaceAll("/", nodePath.sep);
18+
19+
return {
20+
npm: {
21+
publishPath: "package-pack.tgz",
22+
publish: false,
23+
versionArgs: ["--allow-same-version"],
24+
},
25+
git: {
26+
requireBranch: "main",
27+
requireCommits: true,
28+
requireCommitsFail: false, // if there are no new commits release-it will stop the release process, but without throwing and error
29+
requireCleanWorkingDir: true,
30+
commitsPath: ".",
31+
commitMessage: "chore(release): ${npm.name} v${version}",
32+
tagName: "${npm.name}-v${version}",
33+
tagMatch: "${npm.name}-v[0-9]*.[0-9]*.[0-9]*",
34+
getLatestTagFromAllRefs: false, // https://github.com/release-it/release-it/blob/main/docs/git.md#use-all-refs-to-determine-latest-tag
35+
},
36+
github: {
37+
release: true,
38+
releaseName: `${pkgName}@\${version}`,
39+
comments: {
40+
submit: false, // hitting the secondary rate limit issues, see:
41+
// https://github.com/FRSOURCE/toolkit/actions/runs/8730568392/job/23954615077#step:8:38
42+
issue:
43+
":rocket: _This issue has been resolved in [${releaseName} (click for release notes)](${releaseUrl})._",
44+
pr: ":rocket: _This pull request is included in [${releaseName} (click for release notes)](${releaseUrl})._",
45+
},
46+
},
47+
plugins: {
48+
"@release-it/conventional-changelog": {
49+
gitRawCommitsOpts: {
50+
path,
51+
},
52+
preset: "angular",
53+
infile: "CHANGELOG.md",
54+
},
55+
},
56+
hooks: {
57+
"before:bump": buildCmd,
58+
"after:bump": [
59+
"pnpm install",
60+
`git add ${"../".repeat(nestingLevel)}pnpm-lock.yaml`,
61+
],
62+
// "before:npm:release": "mv $(pnpm pack) package-pack.tgz",
63+
// "after:npm:release": "rm package-pack.tgz",
64+
},
65+
};
66+
};

packages/release-it/package.json packages/release-it-config/package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{
22
"name": "@frsource/release-it-config",
3-
"version": "1.0.0",
4-
"main": "dist/index.cjs",
5-
"types": "dist/index.d.ts",
3+
"version": "0.0.0",
4+
"main": "index.cjs",
65
"type": "module",
76
"scripts": {
87
"release": "release-it"
98
},
109
"dependencies": {
11-
"@release-it/bumper": "^6.0.1",
1210
"@release-it/conventional-changelog": "^8.0.1"
1311
},
1412
"devDependencies": {
@@ -17,13 +15,14 @@
1715
"peerDependencies": {
1816
"release-it": ">= 17"
1917
},
20-
"homepage": "https://github.com/FRSOURCE/tooling/",
18+
"homepage": "https://github.com/FRSOURCE/toolkit/",
2119
"repository": {
2220
"type": "git",
23-
"url": "git+https://github.com/FRSOURCE/tooling.git"
21+
"url": "git+https://github.com/FRSOURCE/toolkit.git",
22+
"directory": "packages/release-it-config"
2423
},
2524
"bugs": {
26-
"url": "https://github.com/FRSOURCE/tooling/issues"
25+
"url": "https://github.com/FRSOURCE/toolkit/issues"
2726
},
2827
"author": "Jakub Freisler <[email protected]>",
2928
"license": "MIT",

packages/release-it/monorepoIndependent.cjs

-38
This file was deleted.

0 commit comments

Comments
 (0)