Skip to content

Update npm-publish-github-packages.yml #6

Update npm-publish-github-packages.yml

Update npm-publish-github-packages.yml #6

name: Build and Release
on:
push:
branches:
- main # or any other branch from which you want to deploy
jobs:
build-and-release:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.package_version.outputs.VERSION }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Set this to the version of Node.js that your project uses
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Extract version from package.json
id: package_version
run: echo "VERSION=$(jq -r '.version' package.json)" >> "$GITHUB_OUTPUT"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.package_version.outputs.VERSION }}
release_name: Release ${{ steps.package_version.outputs.VERSION }}
draft: false
prerelease: false
- name: Archive files
run: |
cd bindings/dist
zip -r bridge-${{ steps.package_version.outputs.VERSION }}.zip .
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bindings/dist/bridge-${{ steps.package_version.outputs.VERSION }}.zip
asset_name: bindings-${{ steps.package_version.outputs.VERSION }}.zip
asset_content_type: application/zip