DEV Community

Cover image for Create Deployment Pipeline for React App on Hostinger

Create Deployment Pipeline for React App on Hostinger

Mark Woodson on April 23, 2022

Today, I'll go over the steps needed to create a pipeline to deploy a React app to Hostinger so that whenever you push to your Github repository, y...
Collapse
 
bechir profile image
Bechir Ba

Thanks!

Collapse
 
clockworkaiesh profile image
Ayesha Naveed • Edited

Thanks for this article! Thou it works perfectly but I am not able to see any other pages like /services, /about, /contact.

What could be the reason? I did updated my htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]

but it did not fix the issue. The homepage shows up fine. All other pages give a 404 error

Image description

Collapse
 
mwoodson11 profile image
Mark Woodson

Hi @clockworkaiesh!

Just to clarify, is your .htaccess file named ".htaccess" or just "htaccess", just to make sure the period is at the front?
If not, can you send a picture of your file structure?

Collapse
 
ariibansari profile image
ariibansari

Run s0/git-publish-subdir-action@develop

Cloning into '/tmp/git-publish-subdir-action-PeMhLU/repo'...

From github.com/ariibansari/sevaX-frontend

  • [new branch] build -> build

[info] Checking if branch build exists already

data build

Switched to branch 'build'

[info] Updating branch build

[info] Removing all files from target branch

[info] Copying all files from /home/runner/work/sevaX-frontend/sevaX-frontend/build

[info] Pushing

remote: Write access to repository not granted.
fatal: unable to access 'github.com/ariibansari/sevaX-front... The requested URL returned error: 403

Error: Process exited with code: 128:
remote: Write access to repository not granted.
fatal: unable to access 'github.com/ariibansari/sevaX-front... The requested URL returned error: 403

at ChildProcess.<anonymous> (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:11966:20)
at ChildProcess.emit (node:events:527:28)
at maybeClose (node:internal/child_process:1092:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mwoodson11 profile image
Mark Woodson

Hey @ariibansari are you pushing to your own repo's branch? Looking up similar issues that people have had, it most likely has something to do with the privacy settings! You could try to create a Personal Access Token to use instead of the secrets.GITHUB_TOKEN, but if that's not working please message me and I could try checking out your code/repo to see what the issue may be! Hope we can resolve the issue!

Collapse
 
angelsol299 profile image
Angel

were you able to solve the issue? can you help me? I have exactly the same issue.

Collapse
 
angelsol299 profile image
Angel • Edited

I get this error, what could it be?
I followed all the steps correctly.
And granted the accesses that you nentioned

Image description

Collapse
 
mwoodson11 profile image
Mark Woodson • Edited

It looks like the permissions error where it's not allowing Github Actions to write to your branch. If you already tried using a Personal Access Token instead of the Github Token, can you also check that in your Settings -> Actions -> General -> Workflow permissions, and make sure 'read and write permissions' is selected
Image description

Also you can try adding this to the publish.yaml file:

permissions:
  contents: write
Enter fullscreen mode Exit fullscreen mode
Collapse
 
raoufslv profile image
Raouf Abdallah

what about the .env variables !

Collapse
 
mwoodson11 profile image
Mark Woodson

The only variable you should have to worry about for the site is PUBLIC_URL=<website-domain> in case your site doesn't show up when you try and build! I mention this in the previous tutorial to make sure your site loads first before setting up the pipeline

Collapse
 
kpwebdev profile image
KP Web Dev

I am getting following error in the git actions.

Could you please me out.

Image description

Collapse
 
mwoodson11 profile image
Mark Woodson

Looks like actions/checkout@v2 uses node12, I've updated the script to start using actions/checkout@v3. Thanks for pointing that out!