Skip to content

Commit 613bc20

Browse files
committed
ci: organize deploy scripts
1 parent 2b91826 commit 613bc20

File tree

4 files changed

+130
-75
lines changed

4 files changed

+130
-75
lines changed

.github/workflows/deploy.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Deploy (manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version or semver (e.g., 3.2.0 | patch | minor | major)'
8+
required: true
9+
type: string
10+
tag:
11+
description: 'npm dist-tag to publish under'
12+
required: true
13+
default: latest
14+
type: choice
15+
options:
16+
- latest
17+
- next
18+
create_release:
19+
description: 'Also create a GitHub Release from the tag'
20+
required: false
21+
default: false
22+
type: boolean
23+
git_user_name:
24+
description: 'Git author name for release commit'
25+
required: false
26+
default: 'react-native-iap bot'
27+
type: string
28+
git_user_email:
29+
description: 'Git author email for release commit'
30+
required: false
31+
default: 'github-actions[bot]@users.noreply.github.com'
32+
type: string
33+
34+
permissions:
35+
contents: write
36+
37+
jobs:
38+
publish:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Setup Node.js
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 20.x
51+
registry-url: 'https://registry.npmjs.org'
52+
always-auth: true
53+
54+
- name: Enable Corepack (Yarn 3)
55+
run: corepack enable
56+
57+
- name: Use Yarn 3 cache dir
58+
id: yarn_cache
59+
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
60+
61+
- name: Restore Yarn cache
62+
uses: actions/cache@v4
63+
with:
64+
path: ${{ steps.yarn_cache.outputs.dir }}
65+
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
66+
restore-keys: |
67+
yarn-${{ runner.os }}-
68+
69+
- name: Install dependencies
70+
run: yarn install --immutable
71+
72+
- name: Lint
73+
run: |
74+
yarn lint:tsc
75+
npx eslint --ext .ts,.tsx,.js,.jsx src plugin/src
76+
npx prettier --check "**/*.{md,js,jsx,ts,tsx}"
77+
78+
- name: Configure Git user
79+
run: |
80+
git config user.name "${{ github.event.inputs.git_user_name }}"
81+
git config user.email "${{ github.event.inputs.git_user_email }}"
82+
83+
- name: Bump version and tag
84+
id: bump
85+
env:
86+
INPUT_VERSION: ${{ github.event.inputs.version }}
87+
run: |
88+
# Yarn 3 uses corepack-managed npm; ensure git tagging commit is created
89+
npm version "$INPUT_VERSION" --tag-version-prefix="" -m "chore(release): %s"
90+
NEW_VERSION=$(node -p "require('./package.json').version")
91+
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
92+
93+
- name: Prepare package (build + codegen)
94+
run: yarn prepare
95+
96+
- name: Push commit and tags
97+
run: |
98+
git push --follow-tags
99+
100+
- name: Configure npm auth
101+
env:
102+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
103+
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
104+
105+
- name: Verify npm auth
106+
env:
107+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
108+
run: npm whoami
109+
110+
- name: Publish to npm
111+
env:
112+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
113+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
114+
run: |
115+
if [ "${{ github.event.inputs.tag }}" = "latest" ]; then
116+
npm publish
117+
else
118+
npm publish --tag ${{ github.event.inputs.tag }}
119+
fi
120+
121+
- name: Create GitHub Release
122+
if: ${{ github.event.inputs.create_release == 'true' }}
123+
uses: softprops/action-gh-release@v2
124+
with:
125+
tag_name: ${{ steps.bump.outputs.version }}
126+
name: ${{ steps.bump.outputs.version }}
127+
draft: false
128+
prerelease: ${{ github.event.inputs.tag != 'latest' }}
129+
generate_release_notes: true

.github/workflows/publish-next.yml

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

.github/workflows/publish-package.yml

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

docs/docs/installation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ After installing the package, you need to:
100100
}
101101
}
102102
```
103+
103104
Note migration:
104105
- This option key was renamed from `with-folly-no-couroutines` to `with-folly-no-coroutines`. Update your Expo config accordingly. For compatibility, the plugin temporarily accepts the old key and logs a deprecation warning.
105106

0 commit comments

Comments
 (0)