Update distributables

This commit is contained in:
James M. Greene
2022-09-09 18:44:20 -05:00
parent d2d7f752d5
commit f8578825e2
4 changed files with 30 additions and 6 deletions

16
dist/index.js vendored
View File

@@ -220,6 +220,8 @@ exports.addPath = addPath;
*/ */
function getInput(name, options) { function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
process.stdout.write(`@actions/core getInput(${JSON.stringify(name)}): ${JSON.stringify(val)}\n`)
process.stdout.write(`process.env = ${JSON.stringify(process.env)}\n`)
if (options && options.required && !val) { if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`); throw new Error(`Input required and not supplied: ${name}`);
} }
@@ -8177,7 +8179,8 @@ function getRequiredVars() {
actionsId: process.env.GITHUB_ACTION, actionsId: process.env.GITHUB_ACTION,
githubToken: core.getInput('token'), githubToken: core.getInput('token'),
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com', githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com',
artifactName: core.getInput('artifact_name') ?? 'github-pages' artifactName: core.getInput('artifact_name') ?? 'github-pages',
isPreview: core.getInput('preview') === 'true'
} }
} }
@@ -8227,6 +8230,7 @@ class Deployment {
this.deploymentInfo = null this.deploymentInfo = null
this.githubApiUrl = context.githubApiUrl this.githubApiUrl = context.githubApiUrl
this.artifactName = context.artifactName this.artifactName = context.artifactName
this.isPreview = context.isPreview === true
} }
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages // Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
@@ -8258,6 +8262,9 @@ class Deployment {
pages_build_version: this.buildVersion, pages_build_version: this.buildVersion,
oidc_token: idToken oidc_token: idToken
} }
if (this.isPreview === true) {
payload.preview = true
}
core.info(`Creating deployment with payload:\n${JSON.stringify(payload, null, '\t')}`) core.info(`Creating deployment with payload:\n${JSON.stringify(payload, null, '\t')}`)
const response = await axios.post(pagesDeployEndpoint, payload, { const response = await axios.post(pagesDeployEndpoint, payload, {
headers: { headers: {
@@ -8310,7 +8317,12 @@ class Deployment {
this.deploymentInfo != null this.deploymentInfo != null
? this.deploymentInfo['status_url'] ? this.deploymentInfo['status_url']
: `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/status/${this.buildVersion}` : `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/status/${this.buildVersion}`
core.setOutput('page_url', this.deploymentInfo != null ? this.deploymentInfo['page_url'] : '') let pageUrl = this.deploymentInfo != null ? this.deploymentInfo["page_url"] : ""
const previewUrl = this.deploymentInfo != null ? this.deploymentInfo["preview_url"] : ""
if (this.isPreview && previewUrl) {
pageUrl = previewUrl
}
core.setOutput('page_url', pageUrl)
const timeout = Number(core.getInput('timeout')) const timeout = Number(core.getInput('timeout'))
const reportingInterval = Number(core.getInput('reporting_interval')) const reportingInterval = Number(core.getInput('reporting_interval'))
const maxErrorCount = Number(core.getInput('error_count')) const maxErrorCount = Number(core.getInput('error_count'))

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -220,6 +220,8 @@ exports.addPath = addPath;
*/ */
function getInput(name, options) { function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
process.stdout.write(`@actions/core getInput(${JSON.stringify(name)}): ${JSON.stringify(val)}\n`)
process.stdout.write(`process.env = ${JSON.stringify(process.env)}\n`)
if (options && options.required && !val) { if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`); throw new Error(`Input required and not supplied: ${name}`);
} }
@@ -8177,7 +8179,8 @@ function getRequiredVars() {
actionsId: process.env.GITHUB_ACTION, actionsId: process.env.GITHUB_ACTION,
githubToken: core.getInput('token'), githubToken: core.getInput('token'),
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com', githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com',
artifactName: core.getInput('artifact_name') ?? 'github-pages' artifactName: core.getInput('artifact_name') ?? 'github-pages',
isPreview: core.getInput('preview') === 'true'
} }
} }
@@ -8227,6 +8230,7 @@ class Deployment {
this.deploymentInfo = null this.deploymentInfo = null
this.githubApiUrl = context.githubApiUrl this.githubApiUrl = context.githubApiUrl
this.artifactName = context.artifactName this.artifactName = context.artifactName
this.isPreview = context.isPreview === true
} }
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages // Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
@@ -8258,6 +8262,9 @@ class Deployment {
pages_build_version: this.buildVersion, pages_build_version: this.buildVersion,
oidc_token: idToken oidc_token: idToken
} }
if (this.isPreview === true) {
payload.preview = true
}
core.info(`Creating deployment with payload:\n${JSON.stringify(payload, null, '\t')}`) core.info(`Creating deployment with payload:\n${JSON.stringify(payload, null, '\t')}`)
const response = await axios.post(pagesDeployEndpoint, payload, { const response = await axios.post(pagesDeployEndpoint, payload, {
headers: { headers: {
@@ -8310,7 +8317,12 @@ class Deployment {
this.deploymentInfo != null this.deploymentInfo != null
? this.deploymentInfo['status_url'] ? this.deploymentInfo['status_url']
: `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/status/${this.buildVersion}` : `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/status/${this.buildVersion}`
core.setOutput('page_url', this.deploymentInfo != null ? this.deploymentInfo['page_url'] : '') let pageUrl = this.deploymentInfo != null ? this.deploymentInfo["page_url"] : ""
const previewUrl = this.deploymentInfo != null ? this.deploymentInfo["preview_url"] : ""
if (this.isPreview && previewUrl) {
pageUrl = previewUrl
}
core.setOutput('page_url', pageUrl)
const timeout = Number(core.getInput('timeout')) const timeout = Number(core.getInput('timeout'))
const reportingInterval = Number(core.getInput('reporting_interval')) const reportingInterval = Number(core.getInput('reporting_interval'))
const maxErrorCount = Number(core.getInput('error_count')) const maxErrorCount = Number(core.getInput('error_count'))

File diff suppressed because one or more lines are too long