DEV Community

Cover image for CI/CD with Github for Flutter Web to CPanel
Brishav Shakya
Brishav Shakya

Posted on

5

CI/CD with Github for Flutter Web to CPanel

Introduction

Flutter web can be used to make responsive beautiful web application using canvaskit and html renderer. Flutter provides the best experience for a web application but deploying and hosting it can sometimes be a hectic way to make and host it again and again. For this CI/CD can be used with the help of gitub actions to make our life easier.

Requirement

  1. Install Flutter on your operating system.Installation
  2. Download your preferred IDE such as VS Code or Android Studio
  3. Run the code in the terminal if all the required files and components are installed in your device.

flutter doctor -v

Image description

  1. Create a new project using command-line in terminal by creating a empty folder in your desired path

flutter create cicdflutterdemo

You can use Android Studio to directly create a project as well.

Image description

Image description

This will run the command automatically and create an empty project for you.

  1. Create a git repository in your project

git init
git add.
git commit -m "initial commit
git remote add origin [copied web address]
git push origin main

  1. Do create a repository inside Github to get the web address to push your project to.

  2. After that go to your CPanel login

  3. Go to FTP accounts

  4. Create a FTP credential

Image description

10 . After creating a FTP account go below you will see your FTP client below and click on to configure client

FTP Username: your_id_in_cpanel@demo.com
FTP server: ftp.demo.com
FTP & explicit FTPS port: 21

This will pop up. Copy your password and these setting that was generated.

  1. Next go to your Github repository
  2. Go to GitHub action

Image description

  1. Create a new workflow file

  2. Copy this text to your workflow

Image description

Image description

CI/CD example

  1. After that push your code to your repo
  2. You can manage the push and pull to which branch you want to use CI/CD
  3. In the example it is set to main. You can set it to other branches as well to activate it. And we are done.

Conclusion

So through this simple process we can easily use CI/CD with the help of Github action release our website made by flutter through IDE directly.

So what's your way of hosting the website?

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

The only thing worse than downtime? No Answers.

If you’re sometimes frustrated with opaque infrastructure, sluggish support, and mysterious outages, we prepared a webinar just for you

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️