Publish to npm fixes (#36)
* provide npm token in env * add manual trigger to publish workflow * bump version * accept tag name and release id from manual trigger * log release id * put back missing steps * fix permissions to update release notes
This commit is contained in:
49
.github/workflows/publish.yml
vendored
49
.github/workflows/publish.yml
vendored
@@ -3,13 +3,21 @@ name: Publish to npm
|
|||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [released]
|
types: [released]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag_name:
|
||||||
|
description: "Release tag (e.g., v1.2.3)"
|
||||||
|
required: true
|
||||||
|
release_id:
|
||||||
|
description: "GitHub release ID"
|
||||||
|
required: true
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: publish
|
group: publish
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -24,27 +32,36 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.release.tag_name }}
|
ref: ${{ github.event.release.tag_name || inputs.tag_name }}
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|
||||||
- name: Configure npm authentication
|
- name: Configure npm authentication
|
||||||
run: |
|
run: |
|
||||||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
||||||
|
|
||||||
- name: Download release assets
|
- name: Download release assets
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
|
env:
|
||||||
|
RELEASE_ID: ${{ inputs.release_id }}
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
// Get the release assets
|
const releaseId = context.payload.release?.id || process.env.RELEASE_ID;
|
||||||
|
console.log("releaseId:", releaseId);
|
||||||
|
|
||||||
|
if (!releaseId) {
|
||||||
|
core.setFailed('No release ID found.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const release = await github.rest.repos.getRelease({
|
const release = await github.rest.repos.getRelease({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
release_id: context.payload.release.id
|
release_id: releaseId
|
||||||
});
|
});
|
||||||
|
|
||||||
// Find the .tgz file
|
// Find the .tgz file
|
||||||
@@ -101,14 +118,28 @@ jobs:
|
|||||||
npm publish "$PACKAGE_FILE"
|
npm publish "$PACKAGE_FILE"
|
||||||
|
|
||||||
echo "✅ Successfully published to npm!"
|
echo "✅ Successfully published to npm!"
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
- name: Update release description
|
- name: Update release description
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
|
env:
|
||||||
|
RELEASE_ID: ${{ inputs.release_id }}
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
|
const releaseId = context.payload.release?.id || process.env.RELEASE_ID;;
|
||||||
|
|
||||||
|
// Fetch the release to get the current body
|
||||||
|
const release = await github.rest.repos.getRelease({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
release_id: releaseId
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentBody = release.data.body || '';
|
||||||
await github.rest.repos.updateRelease({
|
await github.rest.repos.updateRelease({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
release_id: context.payload.release.id,
|
release_id: releaseId,
|
||||||
body: context.payload.release.body + '\n\n✅ **Published to npm registry**'
|
body: currentBody + '\n\n✅ **Published to npm registry**'
|
||||||
});
|
});
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vibe-kanban",
|
"name": "vibe-kanban",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "0.0.29",
|
"version": "0.0.30",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"vibe-kanban": "bin/cli.js"
|
"vibe-kanban": "bin/cli.js"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vibe-kanban",
|
"name": "vibe-kanban",
|
||||||
"version": "0.0.29",
|
"version": "0.0.30",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "concurrently \"cargo watch -w backend -x 'run --manifest-path backend/Cargo.toml'\" \"npm run frontend:dev\"",
|
"dev": "concurrently \"cargo watch -w backend -x 'run --manifest-path backend/Cargo.toml'\" \"npm run frontend:dev\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user