Skip to content

Commit 21c7549

Browse files
committed
ci: organize deploy scripts
1 parent 2b91826 commit 21c7549

File tree

4 files changed

+128
-75
lines changed

4 files changed

+128
-75
lines changed

.github/workflows/deploy.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
53+
- name: Enable Corepack (Yarn 3)
54+
run: corepack enable
55+
56+
- name: Use Yarn 3 cache dir
57+
id: yarn_cache
58+
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
59+
60+
- name: Restore Yarn cache
61+
uses: actions/cache@v4
62+
with:
63+
path: ${{ steps.yarn_cache.outputs.dir }}
64+
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
65+
restore-keys: |
66+
yarn-${{ runner.os }}-
67+
68+
- name: Install dependencies
69+
run: yarn install --immutable
70+
71+
- name: Lint
72+
run: yarn lint:ci
73+
74+
- name: Verify no files have changed after auto-fix
75+
run: |
76+
if ! git diff --exit-code -- . ":(exclude)example/*"; then
77+
echo "Lint produced changes outside example/. Please commit fixes." >&2
78+
git status --porcelain
79+
exit 1
80+
fi
81+
82+
- name: Configure Git user
83+
run: |
84+
git config user.name "${{ github.event.inputs.git_user_name }}"
85+
git config user.email "${{ github.event.inputs.git_user_email }}"
86+
87+
- name: Bump version and tag
88+
id: bump
89+
env:
90+
INPUT_VERSION: ${{ github.event.inputs.version }}
91+
run: |
92+
# Yarn 3 uses corepack-managed npm; ensure git tagging commit is created
93+
npm version "$INPUT_VERSION" --tag-version-prefix="" -m "chore(release): %s"
94+
NEW_VERSION=$(node -p "require('./package.json').version")
95+
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
96+
97+
- name: Prepare package (build + codegen)
98+
run: yarn prepare
99+
100+
- name: Push commit and tags
101+
run: |
102+
git push --follow-tags
103+
104+
- name: Configure npm auth
105+
env:
106+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
107+
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
108+
109+
- name: Publish to npm
110+
env:
111+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
112+
run: |
113+
if [ "${{ github.event.inputs.tag }}" = "latest" ]; then
114+
npm publish
115+
else
116+
npm publish --tag ${{ github.event.inputs.tag }}
117+
fi
118+
119+
- name: Create GitHub Release
120+
if: ${{ github.event.inputs.create_release == 'true' }}
121+
uses: softprops/action-gh-release@v2
122+
with:
123+
tag_name: ${{ steps.bump.outputs.version }}
124+
name: ${{ steps.bump.outputs.version }}
125+
draft: false
126+
prerelease: ${{ github.event.inputs.tag != 'latest' }}
127+
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)