Skip to content

Fix bundle script

Fix bundle script #7

name: Generate and Deploy JS Bundle
on:
push:
branches:
- release
workflow_dispatch:
jobs:
generate-bundle:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Delete Existing Release
- name: Delete Existing Release
run: |
curl -X DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/tags/static-release || true
# Step 3: Delete Existing Tag
- name: Delete Existing Tag
run: |
git push --delete origin static-release || true
# Step 4: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
# Step 5: Install dependencies
- name: Install dependencies
run: npm install
# Step 6: Generate the JavaScript bundle
- name: Generate JS bundle
run: |
mkdir -p dist
npx react-native bundle \
--platform android \
--dev false \
--entry-file index.js \
--bundle-output dist/index.android.bundle \
--assets-dest dist/
# Step 7: Upload the bundle to a new GitHub Release
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: dist/index.android.bundle
tag: static-release
releaseName: "Static JS Bundle Release"
body: "This release contains the latest JavaScript bundle for React Native."
draft: false
prerelease: false