-
Notifications
You must be signed in to change notification settings - Fork 4
41 lines (35 loc) · 1.23 KB
/
publish-generator-cli.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
name: Publish Generator CLI
on:
push:
tags: ["*"]
env:
PACKAGE_NAME: "@fern-api/generator-cli"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
GITHUB_TOKEN: ${{ secrets.FERN_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
jobs:
publish_sdk:
if: github.ref_type == 'tag' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/generator-cli@')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📥 Install
uses: ./.github/actions/install
- name: 🧪 Build and test
run: pnpm turbo codegen build test --filter=${{ env.PACKAGE_NAME }}
- name: Publish generator-cli
env:
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
run: |
git_version="$(scripts/generator-cli-version.sh)"
cd clis/generator-cli
mv package.json package.json.tmp
version_replace="s/0.0.0/${git_version}/"
cat package.json.tmp| sed "${version_replace}" > package.json
rm -rf package.json.tmp
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish --access public