andylamax
08/25/2021, 1:16 PMnpm-publish
with no avail. The plugin works well on my machine to publish on ithub packages. But fails on github ci. Have you tested it on CI? Is there an example?Big Chungus
08/25/2021, 1:16 PMBig Chungus
08/25/2021, 1:17 PMandylamax
08/25/2021, 1:17 PMnpmPublishing {
repositories {
repository("github") {
registry = uri("<https://npm.pkg.github.com>")
authToken = System.getenv("GH_TOKEN")
}
}
publications {
val js by getting {
organization = "picortex"
version = "${project.version}-rc.7"
moduleName = "pi-monitor-client-sdk"
readme = file("README.md")
// files { from(".npmrc") }
packageJson {
repository {
type = "git"
url = "<https://github.com/picortex/monitor-client.git>"
}
}
}
}
}
Big Chungus
08/25/2021, 1:18 PMandylamax
08/25/2021, 1:18 PM> Task :pi-monitor-client-sdk:publishJsNpmPublicationToGithub FAILED
npm notice
npm notice 📦 @picortex/pi-monitor-client-sdk@0.0.15-rc.7
npm notice === Tarball Contents ===
npm notice 547.3kB pi-monitor-client-sdk.js
npm notice 256B package.json
npm notice 355B README.md
npm notice 9.9kB pi-monitor-client-sdk.d.ts
npm notice === Tarball Details ===
npm notice name: @picortex/pi-monitor-client-sdk
npm notice version: 0.0.15-rc.7
npm notice package size: 82.3 kB
npm notice unpacked size: 557.8 kB
npm notice shasum: 37648fd517250ae6b790e01e283510a33f751e0e
npm notice integrity: sha512-SMeG/qRA/ZnKk[...]EbC7Zp7a0QsCg==
npm notice total files: 4
npm notice
npm ERR! code E404
npm ERR! 404 Not Found - PUT <https://npm.pkg.github.com/@picortex%2fpi-monitor-client-sdk> - The expected resource was not found.
npm ERR! 404
npm ERR! 404 '@picortex/pi-monitor-client-sdk@0.0.15-rc.7' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-08-25T13_02_19_085Z-debug.log
FAILURE: Build failed with an exception.
Big Chungus
08/25/2021, 1:19 PMandylamax
08/25/2021, 1:19 PMBig Chungus
08/25/2021, 1:21 PMandylamax
08/25/2021, 1:21 PM- name: Setup per user .npmrc
uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: '<https://npm.pkg.github.com>'
scope: '@picortex'
Sadly, not. The project is not open source. But I can share any configuration file you would askBig Chungus
08/25/2021, 1:22 PMandylamax
08/25/2021, 1:22 PMandylamax
08/25/2021, 1:23 PMBig Chungus
08/25/2021, 1:23 PMandylamax
08/25/2021, 1:24 PMandylamax
08/25/2021, 1:25 PMandylamax
08/25/2021, 1:30 PMnpm ERR! code E404
npm ERR! 404 Not Found - PUT <https://npm.pkg.github.com/@picortex%2fpi-monitor-client-sdk> - The expected resource was not found.
npm ERR! 404
npm ERR! 404 '@picortex/pi-monitor-client-sdk@0.0.15-rc.8' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-08-25T13_29_00_452Z-debug.log
FAILURE: Build failed with an exception.
andylamax
08/25/2021, 1:31 PMnpm login --registry=...
on CIBig Chungus
08/25/2021, 1:33 PMBig Chungus
08/25/2021, 1:33 PMBig Chungus
08/25/2021, 1:34 PMBig Chungus
08/25/2021, 1:34 PMandylamax
08/25/2021, 1:36 PMenv:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} -> ${{ github.token }}
Let me change it {{ github.token }}
Big Chungus
08/25/2021, 1:37 PMBig Chungus
08/25/2021, 1:40 PMandylamax
08/25/2021, 1:43 PM- name: Publish pi-monitor-client sdk
env:
GH_TOKEN: ${{ github.token }}
run: ./gradlew :pi-monitor-client-sdk:publishJsNpmPublicationToGithub
Big Chungus
08/25/2021, 1:44 PMandylamax
08/25/2021, 1:44 PMandylamax
08/25/2021, 1:44 PMBig Chungus
08/25/2021, 1:58 PMandylamax
08/25/2021, 2:10 PMandylamax
08/25/2021, 2:14 PMRobert Jaros
08/25/2021, 2:15 PMBig Chungus
08/25/2021, 2:15 PMBig Chungus
08/25/2021, 2:50 PMBig Chungus
08/25/2021, 2:52 PMrepository("GitHub") {
registry = uri("<https://npm.pkg.github.com/>")
}
2. Declare repository
in package.json pointing to your github repo where you want packages to be published to
packageJson {
repository {
type = "git"
url = "<https://github.com/mpetuska/npm-publish.git>"
}
}
3. Set your gradle group
or npm.publish.organization
property to match your GH repo owner's nameBig Chungus
08/25/2021, 2:53 PMBig Chungus
08/25/2021, 2:57 PM@mpetuska/both
vs mpetuska/npm-publish
from above action, would work without step #2 if my package name would be @mpetuska/npm-publish
)andylamax
08/25/2021, 2:59 PM./gradlew :${{ github.event.inputs.sandbox-module }}:publishJsNpmPublicationToGitHub \
-Pnpm.publish.repository.GitHub.authToken="${{ github.token }}" \
-Pversion=${VERSION/v} \
-Pgroup=${{ github.repository_owner }}
or is the gradle script fine as well?Big Chungus
08/25/2021, 3:00 PMBig Chungus
08/25/2021, 3:00 PMBig Chungus
08/25/2021, 3:02 PM-Pnpm.publish.<<prop-path>>=XXXX
npmPublishing {
organization = "GH username"
version = "default npm package version"
}
andylamax
08/25/2021, 3:02 PMBig Chungus
08/25/2021, 3:03 PMandylamax
08/25/2021, 3:03 PMnpmPublishing {
repositories {
repository("github") {
registry = uri("<https://npm.pkg.github.com/picortex>")
authToken = System.getenv("GH_TOKEN")
}
}
publications {
val js by getting {
organization = "picortex"
version = "${project.version}-rc.9"
moduleName = "pi-monitor-client-sdk"
readme = file("README.md")
// files { from(".npmrc") }
packageJson {
repository {
type = "git"
url = "<https://github.com/picortex/monitor-client.git>"
}
}
}
}
}
Big Chungus
08/25/2021, 3:03 PMBig Chungus
08/25/2021, 3:04 PMuri("<https://npm.pkg.github.com>")
Big Chungus
08/25/2021, 3:05 PM.npmrc
file? That's not something you publish normallyandylamax
08/25/2021, 3:09 PM.npmrc
as a way to solve the problem at first. Either way, it wasn't even being publishedBig Chungus
08/25/2021, 3:10 PMandylamax
08/25/2021, 3:12 PMandylamax
08/25/2021, 3:12 PMBig Chungus
08/25/2021, 3:12 PMnpm login
i guessandylamax
08/25/2021, 3:13 PMBig Chungus
08/25/2021, 3:13 PMBig Chungus
08/25/2021, 3:13 PMandylamax
08/25/2021, 3:14 PMimport org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
plugins {
kotlin("multiplatform")
id("tz.co.asoft.library")
id("dev.petuska.npm.publish")
}
rootProject.plugins.withType(NodeJsRootPlugin::class.java) {
rootProject.the<NodeJsRootExtension>().versions.webpackDevServer.version = "4.0.0"
}
kotlin {
jvm { library() }
js(IR) {
val main by compilations
main.outputModuleName = "pi-monitor-client-sdk"
browserLib()
binaries.library()
}
sourceSets {
val commonMain by getting {
dependencies {
api(project(":pi-monitor-core"))
api(project(":bitframe-client-sdk-test"))
api(project(":bitframe-client-viewmodels"))
}
}
}
}
npmPublishing {
repositories {
repository("github") {
registry = uri("<https://npm.pkg.github.com>")
authToken = System.getenv("GH_TOKEN")
}
}
publications {
val js by getting {
organization = "picortex"
version = "${project.version}-rc.9"
moduleName = "pi-monitor-client-sdk"
readme = file("README.md")
packageJson {
repository {
type = "git"
url = "<https://github.com/picortex/monitor-client.git>"
}
}
}
}
}
andylamax
08/25/2021, 3:16 PMandylamax
08/25/2021, 3:16 PMname: Build & Test
on:
push:
branches: [ master ]
env:
REMOTE_HOST: ${{ secrets.MONITOR_HOST }}
REMOTE_USER: ${{ secrets.MONITOR_USER }}
REMOTE_PASS: ${{ secrets.MONITOR_PASS }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} // required by setup node action
REGISTRY: <http://ghcr.io|ghcr.io>
IMAGE_NAME: ${{ github.repository }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
- name: Cache Gradle
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Making gradlew executable
run: chmod +x ./gradlew
working-directory: .
- name: Cache konan
uses: actions/cache@v2
with:
path: |
~/.konan/dependencies
~/.konan/kotlin-native-macos*
key: ${{ runner.os }}-konan-
restore-keys: ${{ runner.os }}-konan-
- name: Cache Node Modules
uses: actions/cache@v2
with:
path: 'build/js'
key: node-modules
- name: Login into github docker registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GH_TOKEN }}
- name: Set Version
id: versions
run: |
./gradlew :pi-monitor:setVersions
echo "::set-output name=current::$(cat ./pi-monitor/build/versioning/current.txt)"
echo "::set-output name=current_safe::$(cat ./pi-monitor/build/versioning/current_safe.txt)"
echo "::set-output name=previous::$(cat ./pi-monitor/build/versioning/previous.txt)"
echo "::set-output name=previous_safe::$(cat ./pi-monitor/build/versioning/previous_safe.txt)"
- name: Setup per user .npmrc
uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: '<https://npm.pkg.github.com>'
scope: '@picortex'
- name: Publish pi-monitor-client sdk
env:
GH_TOKEN: ${{ github.token }}
run: ./gradlew :pi-monitor-client-sdk:publishJsNpmPublicationToGithub
- name: Extract metadata (tags, labels) for Server Docker
id: metaserver
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.title=PiMonitorServer
org.opencontainers.image.vendor=PiCortex
tags: |
type=raw,value=server-${{ steps.versions.outputs.current }}
- name: Extract metadata (tags, labels) for Server Docker
id: metaclient
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
labels: |
org.opencontainers.image.title=PiMonitorClientBrowserReact
org.opencontainers.image.vendor=PiCortex
tags: |
type=raw,value=client-browser-react-${{ steps.versions.outputs.current }}
- name: Create Pi Monitor Server Dockerfile
run: ./gradlew :pi-monitor-server:createDockerfile
- name: Build and push Server Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./pi-monitor/pi-monitor-server/build/binaries
push: true
tags: ${{ steps.metaserver.outputs.tags }}
labels: ${{ steps.metaserver.outputs.labels }}
- name: Create Pi Monitor Browser React Dockerfile
run: ./gradlew :pi-monitor-client-browser-react:createDockerfile
- name: Build and push Client Web Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./pi-monitor/pi-monitor-client/browser/react/build/websites/js
push: true
tags: ${{ steps.metaclient.outputs.tags }}
labels: ${{ steps.metaclient.outputs.labels }}
- name: Create Pi Monitor Docker Compose Staging File
run: ./gradlew :pi-monitor:createDockerComposeStagingFile
- name: Copy Docker-Compose file via ssh password
uses: appleboy/scp-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
password: ${{ env.REMOTE_PASS }}
source: "pi-monitor/build/docker/docker-compose-staging.yml"
rm: true
target: /apps/pi-monitor/${{ steps.versions.outputs.current }}/staging
- name: Deploy Staging Stack
uses: appleboy/ssh-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ env.REMOTE_USER }}
password: ${{ env.REMOTE_PASS }}
script: |
mkdir /apps/pi-monitor/${{ steps.versions.outputs.current }}/staging -p
mv /apps/pi-monitor/${{ steps.versions.outputs.current }}/staging/pi-monitor/build/docker/docker-compose-staging.yml /apps/pi-monitor/${{ steps.versions.outputs.current }}/staging/docker-compose.yml
cd /apps/pi-monitor/${{ steps.versions.outputs.current }}/staging
rm pi-monitor -rf
docker-compose pull
docker stack rm pi-monitor-${{ steps.versions.outputs.previous_safe }}
docker stack deploy -c docker-compose.yml pi-monitor-${{ steps.versions.outputs.current_safe }}
andylamax
08/25/2021, 3:18 PMBig Chungus
08/25/2021, 3:19 PMregistry = uri("<https://npm.pkg.github.com/>")
2. Remove node-setup step (or move it after npm publish stepsandylamax
08/25/2021, 3:21 PMBig Chungus
08/25/2021, 3:22 PMnpmPublishing {
repositories {
repository("github") {
registry = uri("<https://npm.pkg.github.com/>")
authToken = System.getenv("GH_TOKEN")
}
}
}
Big Chungus
08/25/2021, 3:23 PM/
. It's stupid, but npm is often like thatandylamax
08/25/2021, 3:23 PMBig Chungus
08/25/2021, 3:25 PMandylamax
08/25/2021, 3:28 PM/
andylamax
08/25/2021, 3:28 PMBig Chungus
08/25/2021, 3:28 PMBig Chungus
08/25/2021, 3:31 PMandylamax
08/25/2021, 3:31 PMregistry = uri("<https://npm.pkg.github.com/>") // DO NOT REMOVE THE TRAILING SLASH
andylamax
08/25/2021, 3:32 PMBig Chungus
08/25/2021, 3:32 PMandylamax
08/25/2021, 3:35 PMBig Chungus
08/25/2021, 3:40 PMandylamax
08/26/2021, 2:52 AM