-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (74 loc) · 1.94 KB
/
npm-packages.yml
File metadata and controls
89 lines (74 loc) · 1.94 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: npm-packages
on:
push:
branches:
- main
tags:
- "v[0-9]+*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linter
run: npm run lint
- name: Run tests
run: npm test
env:
WAVESPEED_API_KEY: ${{ secrets.WAVESPEED_API_KEY }}
- name: Build package
run: npm run build
- name: Pack package
run: npm pack
- run: ls -lh *.tgz
- uses: actions/upload-artifact@v4
with:
name: npm-packages
path: |
*.tgz
# publish to GitHub Release
gh_release:
name: gh_release
needs: build
runs-on: ubuntu-latest
permissions: write-all
timeout-minutes: 60
defaults:
run:
shell: bash
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- run: ls -R dist/
# create nightly release if it's a push to main
- if: github.repository == 'WaveSpeedAI/wavespeed-javascript' && github.event_name == 'push' && github.ref == 'refs/heads/main'
name: Nightly Release
uses: andelf/nightly-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'Nightly Release $$'
prerelease: true
body: 'TODO: Add nightly release notes'
files: |
dist/*/*.tgz
# create release if it's a tag like vx.y.z
- if: github.repository == 'WaveSpeedAI/wavespeed-javascript' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
name: Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*/*.tgz