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
55
.github/actions/upload-msi/index.js
vendored
Normal file
55
.github/actions/upload-msi/index.js
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const github = require('@actions/github');
|
||||
const core = require('@actions/core');
|
||||
|
||||
const GITHUB_TOKEN = process.env['GITHUB_TOKEN'];
|
||||
const MSI_PATH = 'gh.msi';
|
||||
|
||||
process.on('unhandledRejection', function(reason, _) {
|
||||
handleError(reason);
|
||||
});
|
||||
|
||||
main().catch(handleError)
|
||||
|
||||
async function main() {
|
||||
if (!fs.existsSync(MSI_PATH)) {
|
||||
throw new Error(`Could not find MSI file at ${MSI_PATH}`);
|
||||
}
|
||||
const tag = github.context.ref.replace('refs/tags/', '');
|
||||
|
||||
const owner = github.context.repo.owner;
|
||||
const repo = github.context.repo.repo;
|
||||
|
||||
|
||||
const release = await getRelease(GITHUB_TOKEN, owner, repo, tag);
|
||||
|
||||
const assetFile = fs.readFileSync(MSI_PATH);
|
||||
|
||||
await uploadAsset(GITHUB_TOKEN, release, assetFile);
|
||||
}
|
||||
|
||||
async function getRelease(token, owner, repo, tag) {
|
||||
const octokit = new github.GitHub(token);
|
||||
const response = await octokit.repos.getReleaseByTag({ owner, repo, tag });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function uploadAsset(token, release, assetFile) {
|
||||
const octokit = new github.GitHub(token);
|
||||
await octokit.repos.uploadReleaseAsset({
|
||||
url: release.upload_url,
|
||||
file: assetFile,
|
||||
name: path.basename(MSI_PATH),
|
||||
headers: {
|
||||
'content-type': 'application/octet-stream',
|
||||
'content-length': fs.statSync(MSI_PATH).size,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function handleError(err) {
|
||||
console.error(err);
|
||||
core.setFailed(err.message);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue