Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function run() {
core.warning('This action is moved to azure/containers-actions repository, update your workflows to use those actions instead.');
let pathToDockerConfig = process.env['DOCKER_CONFIG'];
if (pathToDockerConfig && ioUtil.exists(pathToDockerConfig)) {
io.rmRF(pathToDockerConfig); // Deleting the docker config directory
core.debug(`${pathToDockerConfig} has been successfully deleted`);
};
issueCommand('set-env', { name: 'DOCKER_CONFIG' }, '');
console.log('DOCKER_CONFIG environment variable unset');
}
function run() {
core.warning('This action is moved to azure/containers-actions repository, update your workflows to use those actions instead.');
let pathToDockerConfig = process.env['DOCKER_CONFIG'];
if (pathToDockerConfig && ioUtil.exists(pathToDockerConfig)) {
io.rmRF(pathToDockerConfig); // Deleting the docker config directory
core.debug(`${pathToDockerConfig} has been successfully deleted`);
}
;
command_1.issueCommand('set-env', { name: 'DOCKER_CONFIG' }, '');
console.log('DOCKER_CONFIG environment variable unset');
}
run();
core.setFailed(
"No personal access token found. Please provide one by setting the `access-token` input for this action."
)
return
}
const deployBranch = core.getInput("deploy-branch")
if (!deployBranch) deployBranch = "master"
if (github.context.ref === `refs/heads/${deployBranch}`) {
console.log(`Triggered by branch used to deploy: ${github.context.ref}.`)
console.log("Nothing to deploy.")
return
}
const pkgManager = (await ioUtil.exists("./yarn.lock")) ? "yarn" : "npm"
console.log(`Installing your site's dependencies using ${pkgManager}.`)
await exec.exec(`${pkgManager} install`)
console.log("Finished installing dependencies.")
const gatsbyArgs = core.getInput("gatsby-args")
console.log("Ready to build your Gatsby site!")
console.log(`Building with: ${pkgManager} run gatsby build ${gatsbyArgs}`)
await exec.exec(`${pkgManager} run gatsby build`, [gatsbyArgs])
console.log("Finished buidling your site.")
const cnameExists = await ioUtil.exists("./CNAME")
if (cnameExists) {
console.log("Copying CNAME over.")
await io.cp("./CNAME", "./public/CNAME", { force: true })
console.log("Finished copying CNAME.")
}
console.log("Nothing to deploy.")
return
}
const pkgManager = (await ioUtil.exists("./yarn.lock")) ? "yarn" : "npm"
console.log(`Installing your site's dependencies using ${pkgManager}.`)
await exec.exec(`${pkgManager} install`)
console.log("Finished installing dependencies.")
const gatsbyArgs = core.getInput("gatsby-args")
console.log("Ready to build your Gatsby site!")
console.log(`Building with: ${pkgManager} run gatsby build ${gatsbyArgs}`)
await exec.exec(`${pkgManager} run gatsby build`, [gatsbyArgs])
console.log("Finished buidling your site.")
const cnameExists = await ioUtil.exists("./CNAME")
if (cnameExists) {
console.log("Copying CNAME over.")
await io.cp("./CNAME", "./public/CNAME", { force: true })
console.log("Finished copying CNAME.")
}
const repo = `${github.context.repo.owner}/${github.context.repo.repo}`
const repoURL = `https://${accessToken}@github.com/${repo}.git`
console.log("Ready to deploy your new shiny site!")
console.log(`Deploying to repo: ${repo} and branch: ${deployBranch}`)
console.log(
"You can configure the deploy branch by setting the `deploy-branch` input for this action."
)
await exec.exec(`git init`, [], { cwd: "./public" })
await exec.exec(`git config user.name`, [github.context.actor], {
cwd: "./public",
return __awaiter(this, void 0, void 0, function* () {
physicalPath = physicalPath.replace(/[\\]/g, "/");
physicalPath = physicalPath[0] == "/" ? physicalPath.slice(1) : physicalPath;
if (!(yield io_util_1.exists(filePath))) {
throw new Error('FilePathInvalid' + filePath);
}
var httpRequest = {
method: 'PUT',
uri: this._client.getRequestUri(`/api/vfs/${physicalPath}/${fileName}`),
headers: {
'If-Match': '*'
},
body: fs.createReadStream(filePath)
};
try {
var response = yield this._client.beginRequest(httpRequest);
core.debug(`uploadFile. Data: ${JSON.stringify(response)}`);
if ([200, 201, 204].indexOf(response.statusCode) != -1) {
return response.body;
}