build: modify uploads to point to different directories

This commit is contained in:
Keeley Hammond
2024-04-23 16:16:04 -07:00
parent 65bd2db0f5
commit 96120a6f4d
5 changed files with 23 additions and 21 deletions

View File

@@ -10,6 +10,10 @@ on:
env:
# Disable pre-compiled headers to reduce out size - only useful for rebuilds
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_STORAGE_CONTAINER_NAME: ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
GN_BUILDFLAG_ARGS: 'enable_precompiled_headers = false'
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac --custom-var=host_cpu=arm64'
IS_RELEASE: false
@@ -21,12 +25,6 @@ env:
jobs:
checkout:
runs-on: LargeLinuxRunner
environment: ${{ inputs.environment }}
env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_STORAGE_CONTAINER_NAME: ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}
ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }}
steps:
- name: Checkout Electron
uses: actions/checkout@v4
@@ -391,10 +389,10 @@ jobs:
cd src/electron
if [ "$UPLOAD_TO_STORAGE" == "1" ]; then
echo 'Uploading Electron release distribution to Azure'
# script/release/uploaders/upload.py --verbose --upload_to_storage
script/release/uploaders/upload.py --verbose --upload_to_storage
else
echo 'Uploading Electron release distribution to GitHub releases'
# script/release/uploaders/upload.py --verbose
script/release/uploaders/upload.py --verbose
fi
# The current generated_artifacts_<< artifact.key >> name was taken from CircleCI
# tp ensure we don't break anything, but we may be able to improve that.

View File

@@ -21,12 +21,4 @@ on:
jobs:
publish:
uses: electron/electron/.github/workflows/macos-build.yml@gh-macos-publish
with:
environment: production-release
# secrets:
# IS_RELEASE: ${{ secrets.IS_RELEASE }}
# GN_CONFIG: ${{ secrets.GN_CONFIG }}
# STRIP_BINARIES: ${{ secrets.STRIP_BINARIES }}
# GENERATE_SYMBOLS: ${{ secrets.GENERATE_SYMBOLS }}
# CHECK_DIST_MANIFEST: ${{ secrets.CHECK_DIST_MANIFEST }}
# UPLOAD_TO_STORAGE: ${{ secrets.UPLOAD_TO_STORAGE }}
secrets: inherit

View File

@@ -2,6 +2,8 @@
const { BlobServiceClient } = require('@azure/storage-blob');
const path = require('node:path');
// TODO(vertedinde): This variable is a test variable in GHA, sending test artifacts to a test account
// Change this to the real electron artifacts storage account when ready
const blobServiceClient = BlobServiceClient.fromConnectionString(process.env.ELECTRON_ARTIFACTS_BLOB_STORAGE);
const args = require('minimist')(process.argv.slice(2));

View File

@@ -17,6 +17,7 @@ const filePath = process.argv[2];
const fileName = process.argv[3];
const releaseId = parseInt(process.argv[4], 10);
const releaseVersion = process.argv[5];
const isGHActions = process.argv[6];
if (isNaN(releaseId)) {
throw new TypeError('Provided release ID was not a valid integer');
@@ -44,7 +45,9 @@ const getHeaders = (filePath: string, fileName: string) => {
};
const targetRepo = releaseVersion.indexOf('nightly') > 0 ? 'nightlies' : 'electron';
const uploadUrl = `https://uploads.github.com/repos/electron/${targetRepo}/releases/${releaseId}/assets{?name,label}`;
const uploadDefaultUrl = `https://uploads.github.com/repos/electron/${targetRepo}/releases/${releaseId}/assets{?name,label}`;
const uploadGHActionsTestUrl = `https://uploads.github.com/repos/electron/test-releases/releases/${releaseId}/assets{?name,label}`;
const uploadUrl = isGHActions ? uploadGHActionsTestUrl : uploadDefaultUrl;
let retry = 0;
function uploadToGitHub () {

View File

@@ -181,6 +181,9 @@ def parse_args():
parser.add_argument('--verbose',
action='store_true',
help='Mooooorreee logs')
parser.add_argument('-g', '--gh_actions',
help='Sets needed variables for GitHub Actions test runs',
action='store_true')
return parser.parse_args()
@@ -340,6 +343,10 @@ def upload_electron(release, file_path, args):
except NonZipFileError:
pass
is_gh_actions = False
if args.gh_actions:
is_gh_actions = True
# if upload_to_storage is set, skip github upload.
# todo (vertedinde): migrate this variable to upload_to_storage
if args.upload_to_storage:
@@ -349,18 +356,18 @@ def upload_electron(release, file_path, args):
return
# Upload the file.
upload_io_to_github(release, filename, file_path, args.version)
upload_io_to_github(release, filename, file_path, args.version, is_gh_actions)
# Upload the checksum file.
upload_sha256_checksum(args.version, file_path)
def upload_io_to_github(release, filename, filepath, version):
def upload_io_to_github(release, filename, filepath, version, is_gh_actions):
print(f'Uploading {filename} to GitHub')
script_path = os.path.join(
ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-to-github.ts')
with subprocess.Popen([TS_NODE, script_path, filepath,
filename, str(release['id']), version],
filename, str(release['id']), version, is_gh_actions],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) as upload_process:
if is_verbose_mode():