[GitHub Actions] IBM Cloud Foundry Deploy
Published: 2020-09-16 20:38:21

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)

Hey there, this blog post is my submission for the actions hackathon. I will be explaining the problem at first and then will reveal the GitHub action which solves the problem. Happy Reading!


### Problem
I use [IBM cloud foundry](https://www.ibm.com/cloud/cloud-foundry) to host my cloud-native applications. Every time I changed the code, I had to re-deploy it again to cloud foundry via the CLI. I wanted to automate this process. My code is hosted on GitHub, and I was surprised to see that there were **no GitHub actions** available to deploy to Cloud foundry.


### My Workflow
To solve this problem I built [**IBM Cloud Foundry Deploy**](https://github.com/subhamX/ibm-cloud-foundry-deploy) which is a GitHub action. It allows you to deploy 🚀 the application to IBM cloud foundry seamlessly. We can deploy runtimes of **Java, Node.js, PHP, Python, Ruby, ASP.NET, Tomcat, Swift and Go to Cloud Foundry.** 

**What is Cloud Foundry?**
> Cloud Foundry is the industry-standard open source cloud application platform for developing and deploying enterprise cloud applications. Get started today!

For more information on IBM cloud foundry, please visit [here](https://www.ibm.com/cloud/cloud-foundry).


**Features Overview**
- The action supports both authentications using `API key` and using `Username and Password`.
- Now you can seamlessly deploy your application to the IBM cloud foundry on every push.
- The action's logic is independent of the trigger event. More precisely, most of the events that trigger the workflow like `cron`, `push` etc all are supported.


### Submission Category: 

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)
DIY Deployments
Maintainer Must-Haves

### Yaml File or Link to Code

Here is an example YAML snippet for the workflow to be run
```yml
name: Deploy to IBM Cloud Foundry
on:
  push:
    branches: [master]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Deploy MyApp
      uses: subhamx/ibm-cloud-foundry-deploy@master
      with:
        # For Users who have opted for auth using Email & Password
        EMAIL: ${{ secrets.USER_EMAIL }}
        PASSWORD: ${{ secrets.USER_PASSWORD }}
        # For Users who have opted for Authentication using API KEY
        API_KEY: ${{ secrets.IBM_API_KEY }}
        # Cloud Foundry API Endpoint
        CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }}
        # Path to manifest.yml
        MANIFEST_FILE_PATH: './src/manifest.yml'
        # Cloud Foundry ORG Name
        ORG: ${{ secrets.ORG }}
        # Cloud Foundry Space Name for the specified ORG
        SPACE: ${{ secrets.SPACE }}
```


**GitHub Repo**
{% github https://github.com/subhamX/ibm-cloud-foundry-deploy/ %}


### Workflow in action

Head over to this [repo](https://github.com/subhamX/fiboapp) which hosts a simple NodeJS application, and uses this action to deploy the application to IBM Cloud on every push to master branch.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pdiyx0sdm6i1w1bgd0vx.PNG)

Thank You!