Deploy code from Gitea repo to Live wwwroot folder

Hi,

I have following server configuration:

Development Machine
Ubuntu 22
Apache with mySQL

I have created a website on the machine. I have installed Gitea on the same server (Self-Hosted Installation).

I created a local repository and the flow is working perfect.

Now, when my developer pushes the files in gitea repository, I want to copy that file to live website path i.e., /var/www/html/website.com

Can someone please advise on how can I do this?

Thanks in advance.

Have you looked into

Yup, I checked it already.

But, I do not understand how can I install act_installer in ubuntu and implement it. I coundn’t find the document for installation…

Ahh, I found the docs. Let me try it. Thanks for your help.

1 Like

Hi,

The actions work fine with my repository. I tested it by referring to Quick Start | Gitea Documentation

Now, I want to copy the files from repository to live site path.

But, I couldn’t find the source path of the content uploaded in repository. Where do my files reside when I push them?

Or I do need to pull content from git url i.e.

http://192.168.0.111:3000/git-admin/Test.git

I created a shell script to copy content from gitea repository to /var/www/html/website.com path.

When I check the action tab, it is showing failure…

sh /home/harry/code-deploy.sh
sh: 0: cannot open /home/harry/code-deploy.sh: No such file

The script has the code to pull content from my gitea repository to live site path. If I run that script manually it runs fine without any issue.

When I added that script in gitea yaml file, the action is failing.

The code is like this:

name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions
on: [push]

jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: sh /home/harry/code-deploy.sh

Can someone please advice what I am doing wrong?

Where is the file stored?

code-deploy.sh ==> On the same server where my website and gitea as well as runner are installed… Path: /home/harry/code-deploy.sh

Source code ==> /home/abc2/harry-test

To be uploaded path ==> /var/www/html/website.com

Okay, it looks like when I push changes to repository, it’s present working directory is /workspace/git-admin/Harry-Test

I temporarily disabled the shell script.

And even if I try to just sudo su, it can’t perform the action. So, I believe it creates a temporary path to perform actions. That path is not even present on the server physically.

Not sure how to execute my shell script using this Gitea actions.

If anyone has any idea, please share.

Thanks,

See the attached output screen capture

There is no sudo command installed on the default container. You can install sudo with apt-get install -y sudo before use the command.

Thanks, lunny.

But, my script is at outside of docker container.

Shell script path: /home/ows4/code-deploy.sh

If I execute the script command line, it works fine.

But, when I add it in YAML file - GITEA action, it says no such file here. See the attached.

I believe, it is trying to find the shell script path within the docker container. How can I tell that action to find and execute that script outside of the docker. (P.S. I am new to docker. I do not have much knowledge in docker yet…)

Thanks in advance.

How about putting the file into your repository?

Same error.

when I did PWD on the action, it shows path: /workspace/git-admin/harry-test

I believe, the action is trying to find deploy.sh script in above path. Not sure how come the present working directory is set to that path…

If you can confirm the file is there, that means it needs executable permission. You can chmod +x <file_name> before you push it to repository.

1 Like