diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml new file mode 100644 index 0000000..43ea5a2 --- /dev/null +++ b/.github/workflows/deploy-gh-pages.yml @@ -0,0 +1,77 @@ +name: Deploy Static Site to GitHub Pages + +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build static index.html from Select-product-page.jsx + run: | + python3 - << 'PYEOF' + import re, os + + with open('Select-product-page.jsx', 'r') as f: + content = f.read() + + # Replace ES module import with global React reference using regex + # to handle variations in whitespace or quote style + component_code = re.sub( + r'''import\s*\{\s*useState\s*\}\s*from\s*['"]react['"];?''', + 'const { useState } = React;', + content + ) + # Remove export default so MensHealthCombined is a plain function in browser scope + component_code = re.sub( + r'\bexport\s+default\s+function\s+', + 'function ', + component_code + ) + + html = """ + +
+ + +