Continuous Deployment

Continuous Deployment with Fleet CLI and GitHub Actions

This guide shows you how to configure your Fleet functions to be deployed continuously from your GitHub repository.

To start, let's use one of our examples in the Fleet collection. It's a simple example that you can easily replicate in your projects.

Quick Start to continuous deployment

  1. Fork https://github.com/fleetfn/examples to your own GitHub repository.
  2. Create a new Fleet Personal Access Token (Access the Tokens page on the Fleet console)
  3. Create a new project, go to Settings and get the project ID
  4. Go to your newly created repository on GitHub and select Settings
  5. Go to Secrets and create a secret called FLEET_API_TOKEN with the token value from step 2 and create another new secret called FLEET_PROJECT_ID with the value of the project ID from step 3
  6. Create .github/workflow/main.yml with these contents
name: Deploy
on:
      pull_request:
        branches: ['master', 'stable']
      push:
        branches: ['master', 'stable']
jobs:
      deploy:
        runs-on: ubuntu-latest
        name: Deploy
        steps:
          - uses: actions/checkout@v2
          - name: Publish
            uses: fleetfn/fleet-[email protected]
            with:
              apiToken: ${{ secrets.FLEET_API_TOKEN }}
              projectId: ${{ secrets.FLEET_PROJECT_ID }}
              workingDirectory: 'simple-http-endpoint'
  1. Commit your changes and push them up to GitHub

This is where the magic happens! The push triggers a deploy to Fleet and from now on whenever you make a change, your functions will be automatically be redeployed.

If you want to watch the process steps, go to the Repository, and select the Actions tab, where you can view the activity logs of the commands that are running or previous logs.

Further reading

This is the common deployment process that you can start, but you can take advantage of the GitHub Actions environment to manage more complex deployments such as:

  • Interact with other apps
  • Send Slack messages after completion

Anything else you can dream of.