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 }}
|
||||
run: node scripts/publish.js ${{ steps.find.outputs.modified }}
|
||||
- uses: denoland/setup-deno@v1
|
||||
with:
|
||||
deno-version: '1.43.1'
|
||||
- name: Build packages and publish to JSR
|
||||
env:
|
||||
JSR: 1
|
||||
|
|
|
@ -45,7 +45,7 @@ function isMeaningfulChange(pkg, path) {
|
|||
}
|
||||
|
||||
function findChangedPackagesSince(tag, until) {
|
||||
const packages = new Set(listPackages())
|
||||
const packages = new Set(listPackages(true))
|
||||
const changedFiles = findChangedFilesSince(tag, until)
|
||||
|
||||
const changedPackages = new Set()
|
||||
|
@ -91,7 +91,7 @@ if (require.main === module && process.env.CI && process.env.GITHUB_OUTPUT) {
|
|||
let res
|
||||
|
||||
if (input === 'all') {
|
||||
res = listPackages()
|
||||
res = listPackages(true)
|
||||
} else if (input === 'updated') {
|
||||
const tag = getLatestTag()
|
||||
console.log('[i] Latest tag is %s', tag)
|
||||
|
|
|
@ -116,13 +116,16 @@ async function publishSinglePackage(name) {
|
|||
}
|
||||
}
|
||||
|
||||
function listPackages() {
|
||||
function listPackages(all = false) {
|
||||
let packages = []
|
||||
|
||||
for (const f of fs.readdirSync(path.join(__dirname, '../packages'))) {
|
||||
if (f[0] === '.') continue
|
||||
|
||||
if (!all) {
|
||||
if (IS_JSR && JSR_EXCEPTIONS[f] === 'never') continue
|
||||
if (!IS_JSR && JSR_EXCEPTIONS[f] === 'only') continue
|
||||
}
|
||||
|
||||
packages.push(f)
|
||||
}
|
||||
|
@ -180,6 +183,7 @@ async function main(arg = process.argv[2]) {
|
|||
}
|
||||
} else {
|
||||
let pkgs = arg.split(',')
|
||||
let filteredPkgs = []
|
||||
|
||||
const deps = {}
|
||||
// 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] === 'only') continue
|
||||
|
||||
filteredPkgs.push(pkg)
|
||||
|
||||
if (IS_JSR) {
|
||||
const pkgDeps = require(`../packages/${pkg}/package.json`).dependencies || {}
|
||||
deps[pkg] = Object.keys(pkgDeps)
|
||||
|
@ -196,6 +202,8 @@ async function main(arg = process.argv[2]) {
|
|||
}
|
||||
}
|
||||
|
||||
pkgs = filteredPkgs
|
||||
|
||||
if (IS_JSR) {
|
||||
pkgs = stc.determinePublishOrder(deps)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue