Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (lastRelease.version) {
core.debug(`The last release was "${lastRelease.version}".`);
}
// outputs
const { version } = nextRelease;
const major = version.split('.')[0];
const minor = version.split('.')[1];
const patch = version.split('.')[2];
// set outputs
core.exportVariable('NEW_RELEASE_PUBLISHED', 'true');
core.exportVariable('RELEASE_VERSION', version);
core.exportVariable('RELEASE_MAJOR', major);
core.exportVariable('RELEASE_MINOR', minor);
core.exportVariable('RELEASE_PATCH', patch);
core.setOutput('new-release-published', 'true');
core.setOutput('release-version', version);
core.setOutput('release-major', major);
core.setOutput('release-minor', minor);
core.setOutput('release-patch', patch);
}
'-x', '-J', '--force-local',
// For some reason, GNU Tar on Windows expects paths to be slash-separated
'-C', dest.replace(/\\/g, '/'),
'-f', distrib
]);
let cmd = path.join(dest, 'msys2do.cmd');
fs.writeFileSync(cmd, [
'setlocal',
'IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=' + core.getInput('path-type'),
`%~dp0\\msys64\\usr\\bin\\bash.exe -ilc "cd $OLDPWD && %*"`
].join('\r\n'));
core.addPath(dest);
core.exportVariable('MSYSTEM', core.getInput('msystem'));
core.startGroup('Starting MSYS2 for the first time...');
await exec.exec(`msys2do`, (core.getInput('update') == 'true') ?
['pacman', '-Syu', '--noconfirm']
:
['uname', '-a']
);
core.endGroup();
}
catch (error) {
core.setFailed(error.message);
}
}
async function setupRubyEnvironment(rubyVersion) {
// LANG environment must be set or Ruby will default external_encoding to US-ASCII i
// instead of UTF-8 and this will fail many tests.
core.exportVariable('LANG', 'C.UTF-8')
// https://github.com/actions/virtual-environments/issues/267
core.exportVariable('CPPFLAGS', '-DENABLE_PATH_CHECK=0')
// Ensures Bundler retries failed attempts before giving up
core.exportVariable('BUNDLE_RETRY', 1)
// Number of jobs in parallel
core.exportVariable('BUNDLE_JOBS', 4)
// Where to keep the gem files
core.exportVariable('BUNDLE_PATH', gemspecFilePath(rubyVersion))
// enable-shared prevents native extension gems from breaking if they're cached
// independently of the ruby binaries
core.exportVariable('RUBY_CONFIGURE_OPTS', '--enable-shared --disable-install-doc')
// many multiverse suite tests end up in resource contention when run in parallel
core.exportVariable('SERIALIZE', 1)
}
function setupRubyEnvironment() {
// LANG environment must be set or Ruby will default external_encoding to US-ASCII i
// instead of UTF-8 and this will fail many tests.
core.exportVariable('LANG', 'C.UTF-8')
// enable-shared prevents native extension gems from breaking if they're cached
// independently of the ruby binaries
core.exportVariable('RUBY_CONFIGURE_OPTS', '--enable-shared --disable-install-doc')
// https://github.com/actions/virtual-environments/issues/267
core.exportVariable('CPPFLAGS', '-DENABLE_PATH_CHECK=0')
}
await exec.exec("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util", ["-B"]);
// Needed for sudo to pass NIX_IGNORE_SYMLINK_STORE
await exec.exec("sudo", ["sh", "-c", "echo 'Defaults env_keep += NIX_IGNORE_SYMLINK_STORE' >> /etc/sudoers"]);
core.exportVariable('NIX_IGNORE_SYMLINK_STORE', "1");
// Needed for nix-daemon installation
await exec.exec("sudo", ["launchctl", "setenv", "NIX_IGNORE_SYMLINK_STORE", "1"]);
}
// Needed due to multi-user being too defensive
core.exportVariable('ALLOW_PREEXISTING_INSTALLATION', "1");
// TODO: retry due to all the things that go wrong
const nixInstall = await tc.downloadTool('https://nixos.org/nix/install');
await exec.exec("sh", [nixInstall, "--daemon"]);
core.exportVariable('PATH', `${PATH}:/nix/var/nix/profiles/default/bin`)
core.exportVariable('NIX_PATH', `/nix/var/nix/profiles/per-user/root/channels`)
if (type() == "Darwin") {
// macOS needs certificates hints
core.exportVariable('NIX_SSL_CERT_FILE', '/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt');
}
} catch (error) {
core.setFailed(`Action failed with error: ${error}`);
throw(error);
}
}
async function main() {
let isDeploymentSuccess: boolean = true;
try {
// Set user agent variable
let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex');
let actionName = 'DeployWebAppToAzure';
let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS_${actionName}_${usrAgentRepo}`;
core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString);
let endpoint: IAuthorizer = !!core.getInput('publish-profile') ? null : await AuthorizerFactory.getAuthorizer();
let taskParams: TaskParameters = TaskParameters.getTaskParams(endpoint);
let type = DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE;
// get app kind
if(!!taskParams.endpoint) {
await taskParams.getResourceDetails();
type = DEPLOYMENT_PROVIDER_TYPES.SPN;
}
var deploymentProvider = new WebAppDeploymentProvider(type);
core.debug("Predeployment Step Started");
await deploymentProvider.PreDeploymentStep();
core.debug("Deployment Step Started");
function setupRubyEnvironment() {
// LANG environment must be set or Ruby will default external_encoding to US-ASCII i
// instead of UTF-8 and this will fail many tests.
core.exportVariable('LANG', 'C.UTF-8')
// enable-shared prevents native extension gems from breaking if they're cached
// independently of the ruby binaries
core.exportVariable('RUBY_CONFIGURE_OPTS', '--enable-shared --disable-install-doc')
// https://github.com/actions/virtual-environments/issues/267
core.exportVariable('CPPFLAGS', '-DENABLE_PATH_CHECK=0')
}
if (toolPath) {
core.debug(`Tool found in cache ${toolPath}`);
} else {
core.debug('Downloading Flutter from Google storage');
const downloadInfo = getDownloadInfo(version, channel);
const sdkFile = await tc.downloadTool(downloadInfo.url);
let tempDir: string = generateTempDir();
const sdkDir = await extractDownload(sdkFile, tempDir);
core.debug(`Flutter sdk extracted to ${sdkDir}`);
toolPath = await tc.cacheDir(sdkDir, 'flutter', cleanver);
}
core.exportVariable('FLUTTER_HOME', toolPath);
core.addPath(path.join(toolPath, 'bin'));
}
function setREnvironmentVariables() {
core.exportVariable("R_LIBS_USER", path.join(tempDirectory, "Library"));
core.exportVariable("CI", "true");
core.exportVariable("TZ", "UTC");
core.exportVariable("NOT_CRAN", "true");
}
function prependEnv(envName, envValue, divider=' ') {
let existingValue = process.env[envName];
if (existingValue) {
envValue += `${divider}${existingValue}`
}
core.exportVariable(envName, envValue);
}