Deploy an App using Github

In this section, we will see how we can deploy an app on Pollination by triggering a release on Github.

Prerequisite

Since this section builds on it, it is necessary that you go through this section first. Make sure that before you start going through this section, you have an app folder named "wind-rose" with the following structure.

wind-rose
│   README.md

├───.github
│   └───workflows
│           ci.yaml

└───app
        app.py
        Dockerfile
        requirements.txt

You will also need to be comfortable using Github and Github desktop. Use this video to walk yourself through the process of creating a Github repository, cloning it locally, and pushing your changes to it.

Step-1: Write the App

Follow the steps described here to write the app. Once you do that, the structure of your app folder should look like the following;

wind-rose
│   README.md

├───.github
│   └───workflows
│           ci.yaml

└───app
    │   app.py
    │   Dockerfile
    │   requirements.txt

    └───assets
            sample.epw

Step-2: Download Github Desktop

Go to this page, download, and install Github desktop on your system.

Step-3: Create a Github Repository

Once you have created a Github account, click on the "+" button in the top right corner of the screen and click on "New Repository".

Note: Make sure to use the name you want your app on Pollination to have as the Github repository name. We used wind-rose as the project name in the previous section and therefore, we will use that same name here for our Github repository.

Add a description to your repository and create repository.

Click on "Creating a new file"

Name that new file anything you like. We're naming it "sample.txt" here.

Create the new file.

Step-4: Add a Secret

In deployment using the command line, we entered the Pollination API key in the deploy command. In this deployment, we need to add that key as a secret to the Github repository.

Click on "Settings".

Click on "Secrets" and then "Actions"

Click on "New repository secret".

Use "POLLINATION_TOKEN" as the name, paste your Pollination API Key in the box, and click on the "Add secret". Go to this section to learn how to get this Pollination API key.

Note: Make sure to use "POLLINATION_TOKEN" as the name.

You should the pollination token added as a secret to your repository like so;

Step-5: Clone the Repository Locally

Open Github Desktop and click on "Clone a repository from the internet..."

Search for "Wind-rose" and the repository should come up under your account name. Next, choose any local path. This is the path to a folder on your system where you'd like to clone this repository. Lastly, click on "Clone".

Once you clone the repository, the Github Desktop interface should look like so;

Step-6: Push Local Changes

Now we have the App folder created in step-1 (left) and the local repository folder created in the step above (right) open side by side.

Delete the "sample.txt" from the local repository folder.

Copy and paste all the items from the App folder to the local repository folder.

Go to Github Desktop now. You should see all the changes you made in the local repository folder. Choose a short message to describe this change and click on "Commit to main".

Click on "Push origin".

Step-7: Create a Release

Go to your repository on Github and the app folder should show up. That means, all the files necessary to deploy the app are there on Github repository now.

Click on the "Create a new release" link

Click on "Choose a tag"

Write any tag name. We are choosing to write "v0.0.0" here. You can read more here if you are interested versioning.

Write any message to describe the release

You should have successfully created a release on Github

Step-8: Check deployment on Github

This step is optional.

Go you the repository on Github and click on "actions"

You should see the release message with a yellow dot in front of it. This means the deployment from Github has started.

After a few minutes, you will see a green check mark. That will indicate that the deployment from Github was a success.

Step-9: Check deployment on Pollination

Click on your avatar and then click on "Your Apps" on Pollination.

Click on the "wind-rose" app card

Click on "Versions"

At the top of the version history, you should see the app being deployed with the version tag you chose in step-7 above.

After about 5-10 minutes the deployment will finish

Lastly, click on the wind-rose app to see the app in action. You might have to refresh the webpage a few times for the app to appear after the deployment. To refresh use shift + F5 on Chrome or equivalent on your browser.

In the next section, we will see how we can use commit messages to automate App deployment to Pollination.

Last updated