Skip to content

Commit

Permalink
Merge pull request #133 from zowe-actions/fix/prepare-release-script
Browse files Browse the repository at this point in the history
Support prerelease branches in prepareRelease script
  • Loading branch information
t1m0thyj committed Feb 15, 2024
2 parents 7eba626 + e800945 commit 4eb88bb
Show file tree
Hide file tree
Showing 18 changed files with 302 additions and 276 deletions.
513 changes: 257 additions & 256 deletions dist/run-script.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Install Dependencies
run: npm ci

- name: Publish Release
uses: octorelease/octorelease@master
uses: zowe-actions/octorelease@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $ npx octorelease
**Note:** For projects that use GitHub workflows, you don't need to install Octorelease or run it with `npx`. It can be invoked as an action in your workflow instead:

```yaml
- uses: octorelease/octorelease@master
- uses: zowe-actions/octorelease@v1
```

## CI Configuration
Expand Down
6 changes: 4 additions & 2 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as path from "path";
import { fileURLToPath } from "url";
import * as esbuild from "esbuild";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const pkgName = process.argv[2] || path.basename(process.cwd());
const onResolvePlugin = {
name: "onResolve",
Expand All @@ -10,7 +12,7 @@ const onResolvePlugin = {
return { path: "./core", external: true };
});
} else {
build.onResolve({ filter: /^@octorelease\// }, (args) => {
build.onResolve({ filter: /^@octorelease\/[^\/]+$/ }, (args) => {
return { path: args.path.replace("@octorelease", "."), external: true };
});
}
Expand All @@ -21,7 +23,7 @@ await esbuild.build({
bundle: true,
entryPoints: [pkgName === "main" ? "src/main.ts" : "src/index.ts"],
logLevel: "info",
outfile: `../../dist/${pkgName === "main" ? "index" : pkgName}.js`,
outfile: `${__dirname}/dist/${pkgName === "main" ? "index" : pkgName}.js`,
platform: "node",
plugins: [onResolvePlugin]
});
23 changes: 21 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"author": "t1m0thyj",
"license": "Apache-2.0",
"workspaces": [
"packages/*"
"packages/*",
"script"
],
"devDependencies": {
"@types/jest": "^29.4.0",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/run-script/README.md → script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Custom working directory to use instead of the project root.
## Example usage

```yaml
- uses: octorelease/run-script@master
- uses: zowe-actions/octorelease/script@v1
with:
script: npmUpdate
```
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/run-script/package.json → script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "tsc -b && npm run lint",
"lint": "eslint src",
"pack": "node ../../esbuild.mjs",
"pack": "node ../esbuild.mjs run-script",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "tsc -w"
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import { version as lernaVersion } from "@octorelease/lerna";
import { version as npmVersion } from "@octorelease/npm";

export default async function (context: IContext): Promise<void> {
context.version.new = (context.env.VERSION_STRING || "%s").replace("%s",
require("semver").inc(context.version.old, context.branch.level));
context.version.new = context.version.old.split("-")[0];
if (!context.branch.prerelease && context.branch.level !== "none") {
context.version.new = require("semver").inc(context.version.new, context.branch.level);
}
context.version.new = (context.env.VERSION_STRING || "%s").replace("%s", context.version.new);

const packageJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
if (packageJson.workspaces != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as fs from "fs";
import * as github from "@actions/github";
import { IContext } from "@octorelease/core";
import * as properties from "java-properties";
import * as utils from "../src/utils";
import * as utils from "@octorelease/run-script/src/utils";

async function downloadCoverageReports(context: IContext) {
// For GHA workflows triggered by workflow_run event, download coverage artifact from the triggering workflow
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions packages/run-script/tsconfig.json → script/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"rootDir": "./src"
},
"include": ["src"],
"references": [
{
"path": "../core"
"path": "../packages/core"
},
{
"path": "../git"
"path": "../packages/git"
}
]
}
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"path": "packages/npm"
},
{
"path": "packages/run-script"
"path": "packages/vsce"
},
{
"path": "packages/vsce"
}
"path": "script"
},
]
}

0 comments on commit 4eb88bb

Please sign in to comment.