Skip to content

Commit

Permalink
windows
Browse files Browse the repository at this point in the history
  • Loading branch information
eemmiillyy committed Jul 18, 2024
1 parent da2760f commit 73d572e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 39 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/release-cli-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,27 @@ jobs:
MATRIX_OS: ${{ matrix.os }}
COMMIT_SHA: ${{ inputs.commitSha }}

# Necessary to delete deb packes before
# packing windows or machine runs out of space
- name: Release CLI Assets (Windows only)
if: matrix.os == 'ubuntu-latest'
run: |
rm -rf /home/runner/work/client-ts/client-ts/cli/dist/deb
pnpm run release:cli
env:
PUBLISHED_PACKAGES: ${{ inputs.publishedPackages }}
MATRIX_OS: ${{ matrix.os }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ inputs.commitSha }}
OS_OVERRIDE: windows-latest
- name: Upload and Promote CLI Assets (Windows only)
if: matrix.os == 'ubuntu-latest'
run: pnpm run release:cli:upload
env:
MATRIX_OS: ${{ matrix.os }}
COMMIT_SHA: ${{ inputs.commitSha }}
OS_OVERRIDE: windows-latest

- name: Clean up keychain
if: matrix.os == 'macos-latest'
run: |
Expand Down
23 changes: 1 addition & 22 deletions scripts/release-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function main() {
if (!process.env.COMMIT_SHA) throw new Error('COMMIT_SHA is not set');
// if (!publishedPackagesContains(process.env.PUBLISHED_PACKAGES, '@xata.io/cli')) return;

const operatingSystem = matrixToOclif(process.env.MATRIX_OS);
const operatingSystem = matrixToOclif(process.env.OS_OVERRIDE ?? process.env.MATRIX_OS);

const { manifest, fileName } = await readProjectManifest(PATH_TO_CLI);
const {
Expand Down Expand Up @@ -108,27 +108,6 @@ async function main() {
// for (const file of files) {
// // await uploadFiles({ pathToFile: pathToAsset + `/${file}`, fileName: file, octokit, releaseId: release.data.id });
// }

// Pack windows on linux
// if (operatingSystem === 'deb') {
// const platform = 'win';
// // Tarballs
// await exec(`pnpm oclif pack tarballs --targets=${platformDistributions(platform)}`);
// //Packages
// await exec(`pnpm oclif pack ${platform}`);

// // Windows packs files under "win32" directory
// const pathToAssetWindows = `${PATH_TO_CLI}/dist/win32`;
// const files = fs.readdirSync(pathToAssetWindows);
// for (const file of files) {
// // await uploadFiles({
// // pathToFile: pathToAssetWindows + `/${file}`,
// // fileName: file,
// // octokit,
// // releaseId: release.data.id
// // });
// }
// }
}

const uploadFiles = async ({

Check warning on line 113 in scripts/release-cli.ts

View workflow job for this annotation

GitHub Actions / test

'uploadFiles' is assigned a value but never used. Allowed unused vars must match /^_/u
Expand Down
19 changes: 2 additions & 17 deletions scripts/upload-promote.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { createExportableManifest } from '@pnpm/exportable-manifest';
import { readProjectManifest } from '@pnpm/read-project-manifest';
import { writeProjectManifest } from '@pnpm/write-project-manifest';
import { execFile, execFileSync, exec as execRaw } from 'child_process';
import { Octokit } from '@octokit/core';
import fs from 'fs';
import { exec as execRaw } from 'child_process';
import * as util from 'util';
import { matrixToOclif, platformDistributions } from './utils';
const exec = util.promisify(execRaw);
Expand All @@ -12,7 +8,7 @@ async function main() {
if (!process.env.MATRIX_OS) throw new Error('MATRIX_OS is not set');
if (!process.env.COMMIT_SHA) throw new Error('COMMIT_SHA is not set');

const operatingSystem = matrixToOclif(process.env.MATRIX_OS);
const operatingSystem = matrixToOclif(process.env.OS_OVERRIDE ?? process.env.MATRIX_OS);

const PATH_TO_CLI = process.cwd() + '/cli';

Expand All @@ -29,17 +25,6 @@ async function main() {
// Upload packages
await uploadS3(operatingSystem, { pkg: true });
await promoteS3(operatingSystem, version);

// Pack windows on linux
// if (operatingSystem === 'deb') {
// const platform = 'win';

// // Upload Tarballs
// await uploadS3(platform);
// // Upload packages
// await uploadS3(platform, { pkg: true });
// await promoteS3(platform, version);
// }
}
main();

Expand Down
2 changes: 2 additions & 0 deletions scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export const matrixToOclif = (os: string) => {
return 'macos';
case 'ubuntu-latest':
return 'deb';
case 'windows-latest':
return 'win';
default:
throw new Error('Unsupported OS');
}
Expand Down

0 comments on commit 73d572e

Please sign in to comment.