Skip to content

Commit

Permalink
Make realm the default package
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Jul 20, 2023
1 parent e7a9fe4 commit 10f1914
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 84 deletions.
6 changes: 3 additions & 3 deletions parse-release-tag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This action will take a release tag string as input and produce the following output:

1. `package-name`: the name of the package, if set.
1. `package-name`: the name of the package, or `realm` if not set.
2. `package-version`: the version string (10.9.8).
3. `package-version-suffix`: the prerelease suffix of the version tag
4. `prerelease`: set to `true` if a version suffix (`-<something>`) is appended to the tag.
Expand All @@ -18,7 +18,7 @@ For example, the tag "my-package-v42.0.0-alpha.1 would return:
and the tag "v42.0.0" would return:
```
package-name: undefined
package-name: "realm"
package-version: "42.0.0"
package-version-suffix: undefined
prerelease: false
Expand All @@ -31,7 +31,7 @@ and the tag "v42.0.0" would return:
id: parse-release-tag
uses: realm/ci-actions/andrew/parse-release-tag
with:
releaseTag: ${{ github.workspace }}/CHANGELOG.md
release-tag: ${{ github.workspace }}/CHANGELOG.md
- name: Print result version
run: |
echo ${{ steps.parse-release-tag.outputs.package-name }}
Expand Down
4 changes: 2 additions & 2 deletions parse-release-tag/__tests__/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("parseReleaseTag", () => {
const releaseTagWithoutPackage = "v1.0.0";
const parsedReleaseTagWithoutPackage = parseReleaseTag(releaseTagWithoutPackage);
expect(parsedReleaseTagWithoutPackage).deep.equal({
packageName: undefined,
packageName: "realm",
packageVersion: "1.0.0",
packageVersionSuffix: undefined,
prerelease: false,
Expand All @@ -34,7 +34,7 @@ describe("parseReleaseTag", () => {
const releaseTagWithoutPackageWithSuffix = "v1.0.0-alpha.1";
const parsedReleaseTagWithoutPackageWithSuffix = parseReleaseTag(releaseTagWithoutPackageWithSuffix);
expect(parsedReleaseTagWithoutPackageWithSuffix).deep.equal({
packageName: undefined,
packageName: "realm",
packageVersion: "1.0.0",
packageVersionSuffix: "-alpha.1",
prerelease: true,
Expand Down
160 changes: 90 additions & 70 deletions parse-release-tag/dist/index.js

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

2 changes: 1 addition & 1 deletion parse-release-tag/dist/index.js.map

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions parse-release-tag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"name": "parse-release-tag",
"version": "0.0.1",
"description": "Parse a release tag into its components",
"main": "lib/src/main.js",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"build": "ncc build ./src/main.ts --source-map --license licenses.txt",
"format": "prettier --write src/**/*.ts",
"format-check": "prettier --check src/**/*.ts",
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt",
"lint": "eslint src/**/*.ts && npx tsc --noEmit",
"test": "mocha -r ts-node/register '__tests__/**/*.ts'",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
},
Expand Down
2 changes: 1 addition & 1 deletion parse-release-tag/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function parseReleaseTag(releaseTag: string): ParsedReleaseTag {
if (!result) {
throw new Error(`Invalid release tag: ${releaseTag}`);
}
const packageName = result[2];
const packageName = result[2] ?? "realm";
const packageVersion = result[3];
const packageVersionSuffix = result[4];

Expand Down
4 changes: 2 additions & 2 deletions parse-release-tag/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import core from "@actions/core";
import * as core from "@actions/core";
import { parseReleaseTag } from "./helpers";

async function run(): Promise<void> {
try {
const releaseTag = core.getInput("releaseTag");
const releaseTag = core.getInput("release-tag");
const parsedReleaseTag = parseReleaseTag(releaseTag);

core.setOutput("package-name", parsedReleaseTag.packageName);
Expand Down
2 changes: 1 addition & 1 deletion parse-release-tag/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noImplicitAny": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"skipLibCheck": true
},
"exclude": ["node_modules"]
}

0 comments on commit 10f1914

Please sign in to comment.