From e386525424e4d9e83137292c39a8a35d9d1aabde Mon Sep 17 00:00:00 2001 From: nojaf Date: Sat, 9 Nov 2024 11:20:54 +0100 Subject: [PATCH] Try and push npm package to GitHub --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ package-lock.json | 4 ++-- package.json | 15 +++++++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3e8726..d762280 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,3 +31,29 @@ jobs: - name: Generate ReScript code working-directory: ./tools/TypeScript-DOM-lib-generator run: npm run build + + - name: get-npm-version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 + + - name: Get short commit hash + id: vars + run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Update version to - + run: npm version --no-git-tag-version "${{ steps.package-version.outputs.current-version }}-${{ env.COMMIT_HASH }}" + + - name: Package npm project + run: npm pack + + - name: Upload npm package artifact + uses: actions/upload-artifact@v3 + with: + name: npm-package + path: '*.tgz' + + - name: Publish to GitHub Packages + if: github.ref == 'refs/heads/main' + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npm publish ./*.tgz --registry=https://npm.pkg.github.com/ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 75f3d11..037f0f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "experimental-rescript-webapi", - "version": "1.0.0", + "version": "0.1.0-a8c176e", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "experimental-rescript-webapi", - "version": "1.0.0", + "version": "0.1.0-a8c176e", "license": "ISC", "dependencies": { "rescript": "^12.0.0-alpha.4" diff --git a/package.json b/package.json index 5ad0793..feb3ee6 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,21 @@ { "name": "experimental-rescript-webapi", - "version": "1.0.0", + "version": "0.1.0", "description": "Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescript-webapi)", - "main": "index.js", + "author": { + "name": "Florian Verdonck" + }, + "maintainers": [ + "Florian Verdonck (https://github.com/nojaf)" + ], + "files": [ + "src/**/*.res" + ], "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], - "author": "", - "license": "ISC", + "license": "MIT", "dependencies": { "rescript": "^12.0.0-alpha.4" }