Compare commits

..

1 Commits

Author SHA1 Message Date
b28d8151ad node_modules 2019-09-18 13:19:04 +09:00
12 changed files with 24 additions and 108 deletions

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
ko_fi: softprops

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
__tests__/runner/*
# actions requires a node_modules dir https://github.com/actions/toolkit/blob/master/docs/javascript-action.md#publish-a-releasesv1-action
# but its recommended not to check these in https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations
#node_modules

View File

@ -1,7 +1,3 @@
## 0.1.3
* Fixed where `with: body-path` was not being used in generated GitHub releases
## 0.1.2
* Add support for merging draft releases [#16](https://github.com/softprops/action-gh-release/pull/16)
@ -26,7 +22,7 @@ GitHub actions inputs don't inherently support lists of things and one might lik
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
* Add support for prerelease annotated GitHub releases with the new input field `with.prerelease: true` [#19](https://github.com/softprops/action-gh-release/pull/19)
* Add support for prerelease annotated GitHub releases with the new input field `with.prerelease: true`
---

View File

@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@master
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@master
- name: Release
uses: softprops/action-gh-release@v1
env:
@ -80,7 +80,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@master
- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@master
- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
@ -140,7 +140,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@master
- name: Generate Changelog
run: echo "# Good things have arrived" > ${{ github.workflow }}-CHANGELOG.txt
- name: Release

View File

@ -1 +0,0 @@
bar

View File

@ -1,10 +1,4 @@
import {
releaseBody,
isTag,
paths,
parseConfig,
parseInputFiles
} from "../src/util";
import { isTag, paths, parseConfig, parseInputFiles } from "../src/util";
import * as assert from "assert";
describe("util", () => {
@ -22,56 +16,6 @@ describe("util", () => {
);
});
});
describe("releaseBody", () => {
it("uses input body", () => {
assert.equal(
"foo",
releaseBody({
github_ref: "",
github_repository: "",
github_token: "",
input_body: "foo",
input_body_path: undefined,
input_draft: false,
input_prerelease: false,
input_files: [],
input_name: undefined
})
);
});
it("uses input body path", () => {
assert.equal(
"bar",
releaseBody({
github_ref: "",
github_repository: "",
github_token: "",
input_body: undefined,
input_body_path: "__tests__/release.txt",
input_draft: false,
input_prerelease: false,
input_files: [],
input_name: undefined
})
);
});
it("defaults to body when both body and body path are provided", () => {
assert.equal(
"foo",
releaseBody({
github_ref: "",
github_repository: "",
github_token: "",
input_body: "foo",
input_body_path: "__tests__/release.txt",
input_draft: false,
input_prerelease: false,
input_files: [],
input_name: undefined
})
);
});
});
describe("parseConfig", () => {
it("parses basic config", () => {
assert.deepStrictEqual(parseConfig({}), {

View File

@ -16,7 +16,6 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("./util");
const fs_1 = require("fs");
const mime_1 = require("mime");
const path_1 = require("path");
@ -99,7 +98,7 @@ exports.release = (config, releaser) => __awaiter(void 0, void 0, void 0, functi
try {
const tag_name = tag;
const name = config.input_name || tag;
const body = util_1.releaseBody(config);
const body = config.input_body;
const draft = config.input_draft;
const prerelease = config.input_prerelease;
console.log(`👩‍🏭 Creating new GitHub release for tag ${tag_name}...`);

View File

@ -9,11 +9,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const glob = __importStar(require("glob"));
const fs_1 = require("fs");
exports.releaseBody = (config) => {
return (config.input_body ||
(config.input_body_path &&
fs_1.readFileSync(config.input_body_path).toString("utf8")));
};
exports.parseInputFiles = (files) => {
return files.split(/\r?\n/).reduce((acc, line) => acc
.concat(line.split(","))

21
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "action-gh-release",
"version": "0.1.3",
"version": "0.1.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -3437,12 +3437,6 @@
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
},
"lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
"dev": true
},
"lodash.set": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz",
@ -4832,16 +4826,15 @@
"dev": true
},
"ts-jest": {
"version": "24.1.0",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.1.0.tgz",
"integrity": "sha512-HEGfrIEAZKfu1pkaxB9au17b1d9b56YZSqz5eCVE8mX68+5reOvlM93xGOzzCREIov9mdH7JBG+s0UyNAqr0tQ==",
"version": "24.0.2",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-24.0.2.tgz",
"integrity": "sha512-h6ZCZiA1EQgjczxq+uGLXQlNgeg02WWJBbeT8j6nyIBRQdglqbvzDoHahTEIiS6Eor6x8mK6PfZ7brQ9Q6tzHw==",
"dev": true,
"requires": {
"bs-logger": "0.x",
"buffer-from": "1.x",
"fast-json-stable-stringify": "2.x",
"json5": "2.x",
"lodash.memoize": "4.x",
"make-error": "1.x",
"mkdirp": "0.x",
"resolve": "1.x",
@ -4891,9 +4884,9 @@
}
},
"typescript": {
"version": "3.6.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.3.tgz",
"integrity": "sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==",
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz",
"integrity": "sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==",
"dev": true
},
"typescript-formatter": {

View File

@ -1,6 +1,6 @@
{
"name": "action-gh-release",
"version": "0.1.3",
"version": "0.1.1",
"private": true,
"description": "GitHub Action for creating GitHub Releases",
"main": "lib/main.js",
@ -26,14 +26,14 @@
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/jest": "^24.0.18",
"@types/jest": "^24.0.13",
"@types/mime": "^2.0.1",
"@types/node": "^12.7.4",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"jest": "^24.8.0",
"jest-circus": "^24.7.1",
"prettier": "1.18.2",
"ts-jest": "^24.1.0",
"typescript": "^3.6.3",
"ts-jest": "^24.0.2",
"typescript": "^3.5.1",
"typescript-formatter": "^7.2.2"
}
}

View File

@ -1,5 +1,5 @@
import { GitHub } from "@actions/github";
import { Config, releaseBody } from "./util";
import { Config } from "./util";
import { lstatSync, readFileSync } from "fs";
import { getType } from "mime";
import { basename } from "path";
@ -138,7 +138,7 @@ export const release = async (
try {
const tag_name = tag;
const name = config.input_name || tag;
const body = releaseBody(config);
const body = config.input_body;
const draft = config.input_draft;
const prerelease = config.input_prerelease;
console.log(`👩‍🏭 Creating new GitHub release for tag ${tag_name}...`);

View File

@ -1,5 +1,5 @@
import * as glob from "glob";
import { lstatSync, readFileSync } from "fs";
import { lstatSync } from "fs";
export interface Config {
github_token: string;
@ -14,14 +14,6 @@ export interface Config {
input_prerelease?: boolean;
}
export const releaseBody = (config: Config): string | undefined => {
return (
config.input_body ||
(config.input_body_path &&
readFileSync(config.input_body_path).toString("utf8"))
);
};
type Env = { [key: string]: string | undefined };
export const parseInputFiles = (files: string): string[] => {