Add automatic upload of binaries for push events

This script should upload any binaries it has to the `pulsar-rolling-releases` repo
This commit is contained in:
confused-Techie 2023-08-27 01:38:22 -07:00
parent b596922597
commit ac4bcca7e1
3 changed files with 61 additions and 1 deletions

View File

@ -118,7 +118,7 @@ jobs:
PLAYWRIGHT_JUNIT_OUTPUT_NAME=report.xml npx playwright test --reporter=junit,list || echo "Yeah, tests failed, Windows is like this"
- name: Test Binary - macOS
if: matrix.os == 'macos-latest' && env.RUN_MACOS_VT == true
if: matrix.os == 'macos-latest' && env.RUN_MACOS_VT == true
run: |
export PATH="/usr/local/opt/node@16/bin:/usr/local/bin:$PATH"
rm -R node_modules/electron; yarn install --check-files
@ -126,6 +126,15 @@ jobs:
export BINARY_NAME=`ls /Volumes/Pulsar*/Pulsar.app/Contents/MacOS/Pulsar`
PLAYWRIGHT_JUNIT_OUTPUT_NAME=report.xml arch -x86_64 npx playwright test --reporter=junit,list
- name: Add binaries to Rolling Release Repo
if: ${{ github.event_name == 'push' }}
# We only want to upload rolling binaries if they are a commit to master
# Otherwise we want to not upload if it's a PR or manually triggered build
run: |
cd ./script/rolling-release-scripts
npm install
node ./rolling-release-binary-upload.js
- name: Upload Video Artifacts
uses: actions/upload-artifact@v3
with:

View File

@ -0,0 +1,7 @@
{
"name": "rolling-release-scripts",
"description": "Contains possible modules needed for these scripts",
"dependencies": {
"publish-release": "^1.6.1"
}
}

View File

@ -0,0 +1,44 @@
// Inspired by Atom's original Nightly Release Script:
// https://github.com/atom/atom/blob/master/script/vsts/upload-artifacts.js
const fs = require("fs");
const path = require("path");
const publish = require("publish-release");
const pack = require("../../package.json");
(async () => {
if (!fs.existsSync("../../binaries")) {
console.log("No binaries found! Exiting...");
process.exit(1);
}
let binaryAssets = [];
let files = fs.readdirSync("../../binaries");
for (let i = 0; i < files.length; i++) {
binaryAssets.push(path.resolve(`../../binaries/${files[i]}`));
}
console.log("Uploading local binaries to rolling release repo...");
const release = await publish({
token: process.env.GITHUB_TOKEN,
owner: "pulsar-edit",
repo: "pulsar-rolling-releases",
name: pack.version,
notes: `Rolling Release: ${pack.version}`,
tag: `v${pack.version}`,
draft: false,
prerelease: false,
editRelease: true,
reuseRelease: true,
skipIfPublished: false,
assets: binaryAssets
});
console.log(`Releases published successfully: ${release.html_url}`);
process.exit(0);
})();