mirror of
https://github.com/actions/upload-artifact.git
synced 2025-04-20 02:01:21 +00:00
add pages deployment step
This commit is contained in:
parent
7cc38ae471
commit
b9415707f9
32
dist/index.js
vendored
32
dist/index.js
vendored
@ -5542,17 +5542,29 @@ function run() {
|
||||
}
|
||||
else {
|
||||
core.info(`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`);
|
||||
let runtimeUrl = process.env['ACTIONS_RUNTIME_URL'];
|
||||
const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
|
||||
let response = yield axios_1.default.get(artifactUrl, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
const unsignedUrl = response.data.value[0].url;
|
||||
console.log(response);
|
||||
console.log(`unsigned artifact url is ${unsignedUrl}`);
|
||||
response = yield axios_1.default.post("api.github.com/repos/github/hub/pages/deployment", {
|
||||
artifact_url: unsignedUrl,
|
||||
pages_build_version: process.env['GITHUB_SHA']
|
||||
}, {
|
||||
headers: {
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${process.env['GITHUB_TOKEN']}`
|
||||
}
|
||||
});
|
||||
console.log(response.data);
|
||||
}
|
||||
let runtimeUrl = process.env['ACTIONS_RUNTIME_URL'];
|
||||
console.log(runtimeUrl);
|
||||
const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
|
||||
const response = yield axios_1.default.get(artifactUrl, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
console.log(response.data);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
|
@ -67,17 +67,29 @@ async function run(): Promise<void> {
|
||||
core.info(
|
||||
`Artifact ${uploadResponse.artifactName} has been successfully uploaded!`
|
||||
)
|
||||
let runtimeUrl = process.env['ACTIONS_RUNTIME_URL']
|
||||
const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
|
||||
let response = await axios.get(artifactUrl, {
|
||||
headers:{
|
||||
"Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
const unsignedUrl = response.data.value[0].url
|
||||
console.log(response)
|
||||
console.log(`unsigned artifact url is ${unsignedUrl}`)
|
||||
response = await axios.post("api.github.com/repos/github/hub/pages/deployment", {
|
||||
artifact_url: unsignedUrl,
|
||||
pages_build_version: process.env['GITHUB_SHA']
|
||||
}, {
|
||||
headers: {
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${process.env['GITHUB_TOKEN']}`
|
||||
}
|
||||
})
|
||||
console.log(response.data)
|
||||
}
|
||||
let runtimeUrl = process.env['ACTIONS_RUNTIME_URL']
|
||||
console.log(runtimeUrl)
|
||||
const artifactUrl = `${runtimeUrl}_apis/pipelines/workflows/${process.env['GITHUB_RUN_ID']}/artifacts?api-version=6.0-preview`;
|
||||
const response = await axios.get(artifactUrl, {
|
||||
headers:{
|
||||
"Authorization": `Bearer ${process.env["ACTIONS_RUNTIME_TOKEN"]}`,
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
console.log(response.data)
|
||||
}
|
||||
} catch (err) {
|
||||
core.setFailed(err.message)
|
||||
|
Loading…
Reference in New Issue
Block a user