-
Notifications
You must be signed in to change notification settings - Fork 73
52 lines (44 loc) · 1.37 KB
/
npm.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
name: Publish Typescript definitions to NPM
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
npm:
if: github.repository == 'kolmafia/kolmafia'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Generating TypeScript definitions
env:
ORG_GRADLE_PROJECT_commit: ${{ github.sha }}
run: ./gradlew --no-daemon tsDefs
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
- name: Checking generated TypeScript definitions
run: |
cd .github/npm
npm install
npm run validate
- name: Prepare TypeScript package for publication
run: |
PACKAGE_VERSION=$(head -n 1 .github/npm/index.d.ts | cut -c 5-)
sed -i 's/{{version}}/'$PACKAGE_VERSION'/g' .github/npm/package.json
sed -i 's/{{version}}/'$PACKAGE_VERSION'/g' .github/npm/package-lock.json
- name: Publishing TypeScript package to npm
run: |
cd .github/npm
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}