ci: fixed jsr publishing
This commit is contained in:
parent
0cb68f4469
commit
0219f24a8b
3 changed files with 15 additions and 5 deletions
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
|
@ -60,6 +60,8 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: node scripts/publish.js ${{ steps.find.outputs.modified }}
|
run: node scripts/publish.js ${{ steps.find.outputs.modified }}
|
||||||
- uses: denoland/setup-deno@v1
|
- uses: denoland/setup-deno@v1
|
||||||
|
with:
|
||||||
|
deno-version: '1.43.1'
|
||||||
- name: Build packages and publish to JSR
|
- name: Build packages and publish to JSR
|
||||||
env:
|
env:
|
||||||
JSR: 1
|
JSR: 1
|
||||||
|
|
|
@ -45,7 +45,7 @@ function isMeaningfulChange(pkg, path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findChangedPackagesSince(tag, until) {
|
function findChangedPackagesSince(tag, until) {
|
||||||
const packages = new Set(listPackages())
|
const packages = new Set(listPackages(true))
|
||||||
const changedFiles = findChangedFilesSince(tag, until)
|
const changedFiles = findChangedFilesSince(tag, until)
|
||||||
|
|
||||||
const changedPackages = new Set()
|
const changedPackages = new Set()
|
||||||
|
@ -91,7 +91,7 @@ if (require.main === module && process.env.CI && process.env.GITHUB_OUTPUT) {
|
||||||
let res
|
let res
|
||||||
|
|
||||||
if (input === 'all') {
|
if (input === 'all') {
|
||||||
res = listPackages()
|
res = listPackages(true)
|
||||||
} else if (input === 'updated') {
|
} else if (input === 'updated') {
|
||||||
const tag = getLatestTag()
|
const tag = getLatestTag()
|
||||||
console.log('[i] Latest tag is %s', tag)
|
console.log('[i] Latest tag is %s', tag)
|
||||||
|
|
|
@ -116,13 +116,16 @@ async function publishSinglePackage(name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function listPackages() {
|
function listPackages(all = false) {
|
||||||
let packages = []
|
let packages = []
|
||||||
|
|
||||||
for (const f of fs.readdirSync(path.join(__dirname, '../packages'))) {
|
for (const f of fs.readdirSync(path.join(__dirname, '../packages'))) {
|
||||||
if (f[0] === '.') continue
|
if (f[0] === '.') continue
|
||||||
|
|
||||||
|
if (!all) {
|
||||||
if (IS_JSR && JSR_EXCEPTIONS[f] === 'never') continue
|
if (IS_JSR && JSR_EXCEPTIONS[f] === 'never') continue
|
||||||
if (!IS_JSR && JSR_EXCEPTIONS[f] === 'only') continue
|
if (!IS_JSR && JSR_EXCEPTIONS[f] === 'only') continue
|
||||||
|
}
|
||||||
|
|
||||||
packages.push(f)
|
packages.push(f)
|
||||||
}
|
}
|
||||||
|
@ -180,6 +183,7 @@ async function main(arg = process.argv[2]) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let pkgs = arg.split(',')
|
let pkgs = arg.split(',')
|
||||||
|
let filteredPkgs = []
|
||||||
|
|
||||||
const deps = {}
|
const deps = {}
|
||||||
// determine the order of packages to publish
|
// determine the order of packages to publish
|
||||||
|
@ -188,6 +192,8 @@ async function main(arg = process.argv[2]) {
|
||||||
if (IS_JSR && JSR_EXCEPTIONS[pkg] === 'never') continue
|
if (IS_JSR && JSR_EXCEPTIONS[pkg] === 'never') continue
|
||||||
if (!IS_JSR && JSR_EXCEPTIONS[pkg] === 'only') continue
|
if (!IS_JSR && JSR_EXCEPTIONS[pkg] === 'only') continue
|
||||||
|
|
||||||
|
filteredPkgs.push(pkg)
|
||||||
|
|
||||||
if (IS_JSR) {
|
if (IS_JSR) {
|
||||||
const pkgDeps = require(`../packages/${pkg}/package.json`).dependencies || {}
|
const pkgDeps = require(`../packages/${pkg}/package.json`).dependencies || {}
|
||||||
deps[pkg] = Object.keys(pkgDeps)
|
deps[pkg] = Object.keys(pkgDeps)
|
||||||
|
@ -196,6 +202,8 @@ async function main(arg = process.argv[2]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkgs = filteredPkgs
|
||||||
|
|
||||||
if (IS_JSR) {
|
if (IS_JSR) {
|
||||||
pkgs = stc.determinePublishOrder(deps)
|
pkgs = stc.determinePublishOrder(deps)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue