Skip to content

Commit

Permalink
WIP fix
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Jul 10, 2023
1 parent e1b90be commit c9c113a
Show file tree
Hide file tree
Showing 2 changed files with 213 additions and 67 deletions.
158 changes: 147 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1595,18 +1595,154 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install yarn
run: npm install -g yarn
- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-cli-dist
path: packages/perspective-cli/dist

- name: Install js dependencies
run: yarn --frozen-lockfile
env:
PSP_SKIP_EMSDK_INSTALL: 1
- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-dist
path: packages/perspective/dist/

- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-jupyterlab-dist
path: packages/perspective-jupyterlab/dist/

- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-viewer-d3fc-dist
path: packages/perspective-viewer-d3fc/dist

- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-viewer-datagrid-dist
path: packages/perspective-viewer-datagrid/dist

- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-viewer-openlayers-dist
path: packages/perspective-viewer-openlayers/dist

- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-workspace-dist
path: packages/perspective-workspace/dist

- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-viewer-dist
path: rust/perspective-viewer/dist

- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-esbuild-plugin-dist
path: packages/perspective-esbuild-plugin/dist

- name: Run publish script
run: node tools/perspective-scripts/publish.mjs
- uses: actions/download-artifact@v3
if: success() || failure()
with:
name: perspective-webpack-plugin-dist
path: packages/perspective-webpack-plugin/dist

- uses: actions/download-artifact@v3
with:
name: nbextension-dist
path: python/perspective/perspective/nbextension

- uses: actions/download-artifact@v3
with:
name: labextension-dist
path: python/perspective/perspective/labextension

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.7

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.8

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.9

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.10

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-ubuntu-20.04-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.7

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.8

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.9

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.10

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-macos-11-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-window-2019-3.7

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-window-2019-3.8

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-window-2019-3.9

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-window-2019-3.10

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-window-2019-3.11

- uses: actions/download-artifact@v3
with:
name: perspective-python-dist-pyodide

- uses: actions/download-artifact@v3
with:
name: perspective-python-sdist
# path: python/perspective/dist/*.tar.gz

- name: Debug
run: ls -lah

- name: Release wheels
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: |
*.whl
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_WORKFLOW_ID: ${{ github.run_id }}
COMMIT: ${{ github.sha }}
122 changes: 66 additions & 56 deletions tools/perspective-scripts/publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import decompressUnzip from "decompress-unzip";
import { promises as fs } from "fs";
import { Octokit } from "octokit";
import readline from "readline";
import sh from "./sh.mjs";

const CURRENT_TAG = execSync("git describe --exact-match --tags")
.toString()
.trim();
const CURRENT_TAG = sh`git describe --exact-match --tags`.execSync();

// Artifacts Docs:
// https://docs.github.com/en/rest/actions/artifacts
Expand Down Expand Up @@ -216,22 +215,25 @@ if (proceed.toLowerCase() === "y") {
recursive: true,
});

const release = await octokit.request(
"POST /repos/{owner}/{repo}/releases",
{
owner: "finos",
repo: "perspective",
tag_name: CURRENT_TAG,
name: CURRENT_TAG,
body: "Release of perspective",
draft: false,
prerelease: false,
generate_release_notes: false,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
}
);
if (process.env.CI) {
console.log(`Creating GitHub Release ${CURRENT_TAG}`);
const release = await octokit.request(
"POST /repos/{owner}/{repo}/releases",
{
owner: "finos",
repo: "perspective",
tag_name: CURRENT_TAG,
name: CURRENT_TAG,
// body: "Release of perspective",
draft: true,
prerelease: false,
generate_release_notes: true,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
}
);
}

// Download the artifact folders
await Promise.all(
Expand All @@ -247,17 +249,19 @@ if (proceed.toLowerCase() === "y") {
}
);

await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
if (process.env.CI) {
await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
}

if (!artifact.name.includes("pyodide")) {
// Write out the zip file
Expand All @@ -272,27 +276,31 @@ if (proceed.toLowerCase() === "y") {
// Unzip the folders
await Promise.all(
python_dist_folders.map(async (artifact) => {
await decompress(
`${dist_folder}/${artifact.name}.zip`,
`${dist_folder}/${artifact.name}`,
{
plugins: [decompressUnzip()],
}
);
if (!artifact.name.includes("pyodide")) {
await decompress(
`${dist_folder}/${artifact.name}.zip`,
`${dist_folder}/${artifact.name}`,
{
plugins: [decompressUnzip()],
}
);
}
})
);

// Move the wheels
await Promise.all(
python_dist_folders.map(async (artifact) => {
await cp(
[`${dist_folder}/${artifact.name}/*.whl`],
`${wheel_folder}`
);
await cp(
[`${dist_folder}/${artifact.name}/*.tar.gz`],
`${wheel_folder}`
);
if (!artifact.name.includes("pyodide")) {
await cp(
[`${dist_folder}/${artifact.name}/*.whl`],
`${wheel_folder}`
);
await cp(
[`${dist_folder}/${artifact.name}/*.tar.gz`],
`${wheel_folder}`
);
}
})
);

Expand Down Expand Up @@ -326,17 +334,19 @@ if (proceed.toLowerCase() === "y") {
}
);

await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
if (process.env.CI) {
await octokit.request({
method: "POST",
url: release.data.upload_url,
owner: "finos",
repo: "perspective",
data: download.data,
name: `${artifact.name}.zip`,
headers: {
"X-GitHub-Api-Version": "2022-11-28",
},
});
}

// Write out the zip file
await fs.appendFile(
Expand Down

0 comments on commit c9c113a

Please sign in to comment.