Skip to content

Commit

Permalink
test release 12
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelangeloio committed Nov 7, 2023
1 parent a339555 commit 09c92f3
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions .github/auto/crate-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Auto, execPromise, IPlugin, SEMVER } from '@auto-it/core'
import { readdir, readFile, writeFile } from 'fs/promises'
import { readFile, writeFile } from 'fs/promises'
import { join, resolve } from 'path'
import { inc, ReleaseType } from 'semver'
import { parse as parseToml } from 'toml'
import { inspect } from 'util'
/** Get the parsed cargo.toml for the crate */
export const getCargoConfig = async () => {
const content = (await readFile(join(process.cwd() || process.env.GITHUB_WORKSPACE || '', 'Cargo.toml'))).toString()
Expand All @@ -23,34 +22,8 @@ export async function getWorkspaceMembers(): Promise<
}[]
> {
const { toml } = await getCargoConfig()
console.log('\x1b[36m%s\x1b[0m', 'testing', toml)
const members = await Promise.all(toml.workspace.members.map(async (member: string) => {
console.log('\x1b[36m%s\x1b[0m', process.env.GITHUB_WORKSPACE, process.cwd())
const files = await readdir(process.env.GITHUB_WORKSPACE || '');
console.log('\x1b[36m%s\x1b[0m', process.env.GITHUB_WORKSPACE )
files.forEach(file => {
console.log(file, 'workspace');
})
const files2 = await readdir(process.cwd() || '');
console.log('\x1b[36m%s\x1b[0m', process.cwd())
files2.forEach(file => {
console.log(file, 'cwd');
})
const anotherPath = resolve(process.cwd() || process.env.GITHUB_WORKSPACE || '', member)
console.log('\x1b[36m%s\x1b[0m', anotherPath)
const files3 = await readdir(anotherPath);
files3.forEach(file => {
console.log(file, 'w/ member');
})
const trimmedDir = anotherPath.replace('/does-it-throw', '')
console.log('\x1b[36m%s\x1b[0m', trimmedDir)
const files4 = await readdir(trimmedDir);
files4.forEach(file => {
console.log(file, 'w/ member trimmed');
})

const packagePath = resolve(process.cwd() || process.env.GITHUB_WORKSPACE || '', member, 'Cargo.toml')
console.log('\x1b[36m%s\x1b[0m', packagePath)
const packageContent = (await readFile(packagePath)).toString()
const packageToml = parseToml(packageContent.toString())
return {
Expand All @@ -59,7 +32,6 @@ export async function getWorkspaceMembers(): Promise<
packageContent,
}
}))
console.log('\x1b[36m%s\x1b[0m', inspect(members))
return members
}

Expand All @@ -68,7 +40,6 @@ export async function bumpVersions(bumpBy: SEMVER) {
const workspaceMembers = await getWorkspaceMembers()
const promises = workspaceMembers.map(async (member) => {
const { packagePath, packageContent, packageToml } = member
console.log('\x1b[36m%s\x1b[0m', packageContent, packagePath, packageToml)
const versionOld = packageToml.package.version
const versionNew = inc(versionOld, bumpBy as ReleaseType)

Expand Down

0 comments on commit 09c92f3

Please sign in to comment.