-
-
Notifications
You must be signed in to change notification settings - Fork 6
58 lines (47 loc) · 1.69 KB
/
npm-publish-github-packages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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