WIP: Build & Release
This commit is contained in:
26
.github/workflows/buildScripts/downloadArtifacts.js
vendored
Normal file
26
.github/workflows/buildScripts/downloadArtifacts.js
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
module.exports = async ({ github, context, core, jobId, name }) => {
|
||||
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: jobId,
|
||||
});
|
||||
if (artifacts.data.total_count === 0) {
|
||||
core.setFailed("No artifacts found for jobID: " + jobId);
|
||||
return false;
|
||||
}
|
||||
const artifact = artifacts.data.artifacts.find(
|
||||
(artifact) => artifact.name === name
|
||||
);
|
||||
if (!artifact) {
|
||||
core.setFailed(`${name} not found in artifacts`);
|
||||
return false;
|
||||
}
|
||||
const response = await github.rest.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: artifact.id,
|
||||
archive_format: "zip"
|
||||
});
|
||||
require('fs').writeFileSync(`${name}.zip`, Buffer.from(response.data));
|
||||
require('child_process').execSync(`unzip -o ${name}.zip -d ./${jobId}`);
|
||||
};
|
||||
11
.github/workflows/buildScripts/getLastBuildId.js
vendored
Normal file
11
.github/workflows/buildScripts/getLastBuildId.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = async ({ github, context }) => {
|
||||
const { data: runs } = await github.rest.actions.listWorkflowRuns({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: "build.yml",
|
||||
branch: "main",
|
||||
status: "success",
|
||||
per_page: 1,
|
||||
});
|
||||
return runs.workflow_runs[0].id;
|
||||
};
|
||||
3
.github/workflows/buildScripts/replaceTokens.js
vendored
Normal file
3
.github/workflows/buildScripts/replaceTokens.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = async ({ github, context, core, jobId }) => {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user