restock: rebuilds all vx & platforms for a project

This commit is contained in:
Max Howell 2023-12-29 08:20:50 +00:00
parent 7f110f2627
commit b00f951397
No known key found for this signature in database
GPG key ID: 741BB84EF5BB9EEC
2 changed files with 51 additions and 0 deletions

17
.github/scripts/inventory.ts vendored Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env -S pkgx deno run --allow-net
const [project] = Deno.args
let versions: string[] = []
for (const platform of ["linux", "darwin"]) {
for (const arch of ["x86-64", "aarch64"]) {
const url = `https://dist.pkgx.dev/${project}/${platform}/${arch}/versions.txt`
const txt = await (await fetch(url)).text()
versions.push(...txt.split("\n"))
}
}
versions = [...new Set(versions.filter(x => x.trim()))]
console.log(JSON.stringify(versions))

34
.github/workflows/restock.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: restock project inventory
run-name: rebuilding ${{ inputs.project }}
on:
workflow_dispatch:
inputs:
project:
description: a single project, eg. `foo.com`
required: true
type: string
jobs:
ingest:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.fetch.outputs.plan }}
steps:
- uses: pkgxdev/setup@v2
- uses: actions/checkout@v4
- run: ./.github/actions/inventory.ts ${{ inputs.project }}
id: fetch
pkg:
needs: ingest
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.ingest.outputs.versions) }}
uses: ./.github/workflows/pkg.yml
permissions:
issues: write #FIXME we dont want this but I dont think we can alter the way permissions are inherited
with:
pkg: ${{inputs.project}}=${{ matrix.version }}
secrets: inherit