Skip to content

Commit f2b8c80

Browse files
committed
feat: added publish steps
1 parent 8578ba7 commit f2b8c80

File tree

2 files changed

+63
-26
lines changed

2 files changed

+63
-26
lines changed

.github/workflows/ci.yml

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
# Job 3: Build
5656
build:
5757
name: Build
58-
needs: [lint, format]
58+
needs: [ lint, format ]
5959
runs-on: ubuntu-latest
6060
steps:
6161
- name: Checkout code
@@ -81,7 +81,7 @@ jobs:
8181

8282
report:
8383
name: Report
84-
needs: [build]
84+
needs: [ build ]
8585
runs-on: ubuntu-latest
8686
steps:
8787
- name: Checkout code
@@ -103,3 +103,64 @@ jobs:
103103
104104
- name: Generate report
105105
run: cargo run report
106+
107+
detect-changes:
108+
if: startsWith(github.ref, 'refs/tags/v')
109+
needs: report
110+
runs-on: ubuntu-latest
111+
outputs:
112+
cli_changed: ${{ steps.filter.outputs.cli }}
113+
packages_changed: ${{ steps.filter.outputs.packages }}
114+
md_changed: ${{ steps.filter.outputs.md }}
115+
steps:
116+
- uses: actions/checkout@v4
117+
- name: Detect changed paths
118+
id: changes
119+
uses: dorny/paths-filter@v3
120+
with:
121+
base: "main"
122+
filters: |
123+
cli:
124+
- 'cli/**'
125+
packages:
126+
- 'reader/**'
127+
md:
128+
- 'definitions/**'
129+
130+
publish-ts-reader:
131+
needs: detect-changes
132+
if: startsWith(github.ref, 'refs/tags/v') && needs.detect-changes.outputs.packages_changed == 'true'
133+
defaults:
134+
run:
135+
working-directory: "./reader/ts"
136+
runs-on: ubuntu-latest
137+
steps:
138+
- uses: actions/checkout@v4
139+
- uses: actions/setup-node@v4
140+
with:
141+
node-version: '22.x'
142+
registry-url: 'https://registry.npmjs.org'
143+
- run: npm version from-git --git-tag-version=false
144+
- run: npm ci
145+
- run: npm run build
146+
- run: npm publish
147+
env:
148+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
149+
150+
publish-defintions:
151+
needs: detect-changes
152+
if: startsWith(github.ref, 'refs/tags/v') && needs.detect-changes.outputs.md == 'true'
153+
runs-on: ubuntu-latest
154+
steps:
155+
- name: Checkout Code
156+
uses: actions/checkout@v4
157+
158+
- name: Create GitHub Release
159+
uses: softprops/action-gh-release@v2
160+
with:
161+
tag_name: ${{ github.ref_name }}
162+
name: Release ${{ github.ref_name }}
163+
files: |
164+
definitions
165+
generate_release_notes: true
166+
make_latest: true

.github/workflows/publish-reader.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)