main: notify huppy after release

pull/1379/head
alex 2023-05-15 14:17:19 +01:00
rodzic fff9c4c09b
commit f1e9981aae
2 zmienionych plików z 18 dodań i 0 usunięć

Wyświetl plik

@ -49,3 +49,4 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HUPPY_TOKEN: ${{ secrets.HUPPY_TOKEN }}

Wyświetl plik

@ -1,9 +1,14 @@
import { Auto } from '@auto-it/core'
import fetch from 'cross-fetch'
import { assert } from 'node:console'
import { parse } from 'semver'
import { exec } from './lib/exec'
import { getLatestVersion, publish, setAllVersions } from './lib/publishing'
async function main() {
const huppyToken = process.env.HUPPY_TOKEN
assert(huppyToken && typeof huppyToken === 'string', 'HUPPY_ACCESS_KEY env var must be set')
const auto = new Auto({
plugins: ['npm'],
baseBranch: 'main',
@ -61,6 +66,18 @@ async function main() {
// finally, publish the packages [IF THIS STEP FAILS, RUN THE `publish-manual.ts` script locally]
await publish()
console.log('Notifying huppy of release...')
const huppyResponse = await fetch('http://localhost:3000/api/on-release', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ apiKey: huppyToken, tagToRelease: `v${nextVersion}`, canary: false }),
})
console.log(
`huppy: [${huppyResponse.status} ${huppyResponse.statusText}] ${await huppyResponse.text()}`
)
}
main()