Skip to content

Commit

Permalink
Release v0.4.0 with build.yaml artifact downloading support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinjil committed Jun 7, 2022
1 parent 1c95ff8 commit a7832ec
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function getYaml(octokit, repo, path, ref = undefined) {
* @param {string} content The file content to commit.
*/
async function commit(octokit, repo, branch, path, message, content) {
const { data: current } = await octokit.rest.repos.getContent({...repo, path, ref: `heads/${branch}`})
const { data: current } = await octokit.rest.repos.getContent({ ...repo, path, ref: `heads/${branch}` })
const contentEncoded = Buffer.from(content).toString('base64');
await octokit.rest.repos.createOrUpdateFileContents({
...repo,
Expand All @@ -53,7 +53,7 @@ async function run() {
const repository = core.getInput('repository', { required: true });
const pagesBranch = core.getInput('pagesBranch', { required: true });
const pagesFile = core.getInput('pagesFile', { required: true });
const ignorePrereleases = core.getBooleanInput('ignorePrereleases', { required: true });
const ignorePrereleases = core.getBooleanInput('ignorePrereleases', { required: true });

const octokit = github.getOctokit(githubToken);
const repoParts = repository.split('/')
Expand Down Expand Up @@ -90,13 +90,15 @@ async function run() {
console.error('Failed to download plugin checksum: HTTP', response.status);
}
}
// If build.yaml given as asset, prefer that for release config

if ( asset.name == "build.yaml" ) {
// If build.yaml given as asset, prefer that for release config.
if (asset.name == "build.yaml") {
console.log(`Found release asset build.yaml, using that instead of ${release.tag_name}/build.yaml`);
const response = await octokit.request(asset.browser_download_url);
if (response.status === 200) {
releaseConfig = yaml.parse(Buffer.from(response.data).toString('UTF-8'));
} else {
console.error('Failed to download plugin build configuration: HTTP', response.status);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"prepare": "ncc build main.js -o dist -m --source-map --license LICENSE"
},
"version": "0.3.0",
"version": "0.4.0",
"description": "A GitHub action which generates a Jellyfin plugin repository manifest file as a GitHub action.",
"main": "main.js",
"dependencies": {
Expand All @@ -18,4 +18,4 @@
"devDependencies": {
"@vercel/ncc": "^0.34.0"
}
}
}

0 comments on commit a7832ec

Please sign in to comment.