Connecting the LAMP app with Git
-
HeyO

Now there is this GitHub Repository: https://github.com/cloudron-io/cloudron-push-to-app which publishes this action to the GitHub Marketplace https://github.com/marketplace/actions/cloudron-push-to-app
The README should explain how to use it.
Still, this can be confusing for people who never used GitHub actions.I have created a demo repo https://github.com/BrutalBirdie/github-action-test-repo and added the workflow according to my README.
Added an Environment:

and the secrets:

Now if I update the
README.md, add a simpleindex.htmlandindex.cssit will be deployed to https://default-lamp.cloudron.dev/ when accessing https://default-lamp.cloudron.dev you should see some neon 404 page and you can access theREADME.mdhttps://default-lamp.cloudron.dev/README.mdAnd in the action view you can see the executed action and logs https://github.com/BrutalBirdie/github-action-test-repo/actions/runs/19704245518/job/56447718391
-
Oh nice, this is incredible. Can you also make a guide @BrutalBirdie ? A PR to https://docs.cloudron.io/guides/ would be awesome .
Not a PHP dev but when/where does one run "composer install" in the workflow ? Maybe in the action itself?
-
I keep getting this error message

I have ensured that the URL, Token, and App ID are correct.
Here is my YAML file
on: push: branches: - main jobs: deploy-to-cloudron-app: runs-on: ubuntu-latest environment: my.domain.com steps: - name: Checkout Repository uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.3' extensions: pdo_mysql, pdo, json, mbstring, curl coverage: none - name: Verify PHP Extensions run: | echo "PHP Version:" php -v echo -e "\nInstalled Extensions:" php -m | grep -E "(pdo_mysql|pdo|json|mbstring|curl)" || echo "Some extensions not found" echo -e "\nAll PHP Extensions:" php -m - name: Install composer dependencies run: | composer install --no-interaction --prefer-dist --optimize-autoloader - name: Verify Cloudron Connection run: | if [ -z "${{ secrets.CLOUDRON_URL }}" ]; then echo "Error: CLOUDRON_URL secret is not set" exit 1 fi echo "Cloudron URL configured: ${{ secrets.CLOUDRON_URL }}" echo "App ID: ${{ secrets.CLOUDRON_APP_ID }}" - name: Cloudron Push to App uses: cloudron-io/cloudron-push-to-app@latest with: CLOUDRON_URL: "${{ secrets.CLOUDRON_URL }}" CLOUDRON_TOKEN: "${{ secrets.CLOUDRON_TOKEN }}" CLOUDRON_APP_ID: "${{ secrets.CLOUDRON_APP_ID }}" CLOUDRON_PUSH_DESTINATION: "/app/data" (I want to push to this directory, rather then to public) CLOUDRON_CREATE_APP_BACKUP: "false" -
Ah, yes,
CLOUDRON_URLis a misleading variable name, changing it toCLOUDRON_FQDN.
So the documented example ofmy.demo.cloudron.iois correct.
I have updated the GitHub Action repo, Example Repo and Cloudron documentation (will be deployed soon) accordingly.I have added the
demobranch to demo GitHub project https://github.com/cloudron-io/github-action-test-repo and the file .github/workflows/deploy-to-my-demo-cloudron-io.yaml which is using a clear text token, url, and appid for better understanding and only deploys on the demo branch.
You can use this file as a copy-and-paste example for testing.
But be aware, the APP_ID and TOKEN might be outdated anytime if themy.demo.cloudron.ioserver is reset or someone deletes the app. -
@privsec said in Connecting the LAMP app with Git:
(I want to push to this directory, rather then to public)
Note on that.
The action runs:cloudron push --app ${CLOUDRON_APP_ID} ${GITHUB_WORKSPACE}/. ${CLOUDRON_PUSH_DESTINATION}Be aware of the
/.after${GITHUB_WORKSPACE}.
From the cloudron cli:cloudron push --help Usage: cloudron push [options] <local> <remote> push a single local file or directory to a remote directory Options: --app <id/location> App id or location -h, --help display help for command Examples: $ cloudron push --app myapp file.txt /app/data/file.txt # pushes file.txt $ cloudron push --app myapp file.txt /app/data/ # pushes file.txt. trailing slash is important $ cloudron push --app myapp dir /app/data # pushes dir/* as /app/data/dir/* $ cloudron push --app myapp dir/. /app/data # pushes dir/* as /app/data/* $ cloudron push --app myapp dir/subdir /app/data # pushes dir/subdir/* as /app/data/subdir/* $ cloudron push --app myapp . /app/data # pushes .* as /app/data/*Meaning, if you set
CLOUDRON_PUSH_DESTINATION: "/app/data", yes, everything in the GitHub repository will be pushed to/app/data, but be aware, this does not delete existing files.
So, if you have the file/app/data/historic.txtand this is not in your GitHub repo, after the action has run, this file will still exist.This could be seen as inconvenient, but, let's take the following scenario:
You have the folder/app/data/static/imageswhich holds all your static image assets and in the GitHub repo you havestatic/images/.gitkeepan empty folder that is still tracked by git but empty.
If I changed the GitHub Action to overwrite theCLOUDRON_PUSH_DESTINATIONinstead of copying into it, all the/app/data/static/imagesfiles would be deleted.Just wanted to make you aware of that
