automatically produce MSI files for releases
This commit: - Adds config for building Windows installers - Adds an action for fetching exe files built by goreleaser - Adds an action for building Windows installers - Adds an action for adding MSI files to an existing GH release - Adds MSI signing to our release flow - Disables homebrew formula bumping for prereleases - Allows the release asset copying action to copy windows assets
This commit is contained in:
parent
67c4d5cdc0
commit
06d90d5e46
24 changed files with 35954 additions and 10 deletions
64
.github/actions/build-msi/index.js
vendored
Normal file
64
.github/actions/build-msi/index.js
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
const exec = require('@actions/exec');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
process.on('unhandledRejection', function(reason, _) {
|
||||
handleError(reason);
|
||||
});
|
||||
|
||||
function addToPath(_path) {
|
||||
console.log(`adding ${_path} to Path`);
|
||||
process.env['Path'] = _path + ';' + process.env['Path'];
|
||||
}
|
||||
|
||||
main().catch(handleError)
|
||||
|
||||
async function main() {
|
||||
const exePath = core.getInput('exe');
|
||||
const version = github.context.ref.replace('refs/tags/', '');
|
||||
|
||||
console.log(`Building MSI for version ${version}`);
|
||||
const wixPath = process.env['WIX'] + '\\bin';
|
||||
|
||||
addToPath(wixPath);
|
||||
|
||||
await go_msi(version, exePath);
|
||||
}
|
||||
|
||||
async function go_msi(version, exePath) {
|
||||
const cwd = process.cwd();
|
||||
|
||||
// go-msi was struggling with its default temp dir; it wanted something relative to the source dir
|
||||
// for some reason.
|
||||
console.log('making build path');
|
||||
const buildPath = path.join(cwd, 'build');
|
||||
fs.mkdirSync(buildPath);
|
||||
|
||||
console.log('making bin path');
|
||||
const binPath = path.join(cwd, 'bin');
|
||||
fs.mkdirSync(binPath);
|
||||
console.log(`moving ${exePath} to bin/gh.exe`);
|
||||
fs.renameSync(exePath, path.join(binPath, 'gh.exe'));
|
||||
|
||||
const msiPath = path.join(cwd, 'gh.msi');
|
||||
|
||||
try {
|
||||
await exec.exec(
|
||||
'"C:\\Program Files\\go-msi\\go-msi.exe"',
|
||||
['make',
|
||||
'--msi', msiPath,
|
||||
'--out', buildPath,
|
||||
'--version', version]);
|
||||
console.log(`build MSI at ${msiPath}`);
|
||||
core.setOutput('msi', msiPath);
|
||||
} catch(e) {
|
||||
core.setFailed(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleError(err) {
|
||||
console.error(err);
|
||||
core.setFailed(err.message);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue