Skip to content

Deploying with GitHub Actions

This guide explains how to set up a GitHub Action that automatically triggers a new deployment on Seenode whenever a commit is pushed to a specified branch.

  • A GitHub repository containing your application.
  • An existing Seenode application linked to that repository.
  • An API token for the Seenode API.
  • Permissions to create GitHub Actions and manage repository secrets.
  1. Add Secrets to GitHub

    To keep your credentials secure, store them as encrypted secrets in your GitHub repository.

    1. In your GitHub repository, go to Settings > Secrets and variables > Actions.
    2. Click New repository secret to add the following secrets:
      • SEENODE_APPLICATION_ID: The ID of your Seenode application.
      • SEENODE_API_TOKEN: Your Seenode API token.
  2. Create the GitHub Actions Workflow

    Create a workflow file in your repository to define the deployment job.

    1. Create a .github/workflows/ directory in your repository if it doesn’t already exist.
    2. Inside this directory, create a new file named deploy.yml.
    3. Add the following content to the deploy.yml file:
    .github/workflows/deploy.yml
    name: Deploy to Seenode
    on:
    push:
    branches:
    - main # Trigger the workflow on pushes to the main branch
    jobs:
    deploy:
    runs-on: ubuntu-latest
    steps:
    - name: Trigger Seenode Deployment
    run: |
    curl -X POST \
    -H "Authorization: Bearer ${{ secrets.SEENODE_API_TOKEN }}" \
    -H "Content-Type: application/json" \
    -d '{"gitCommitSha": "${{ github.sha }}"}' \
    "https://api.seenode.com/v1/applications/${{ secrets.SEENODE_APPLICATION_ID }}/deployments"

    This workflow will be triggered on every push to the main branch. It sends a POST request to the Seenode API to trigger a new deployment using the latest commit.

  3. Commit and Push

    Commit the new workflow file to your repository to activate it.

    Terminal
    git add .github/workflows/deploy.yml
    git commit -m "ci: Add GitHub Action for Seenode deployment"
    git push
  4. Verify the Deployment

    Once you’ve pushed the workflow, you can verify that it’s working correctly.

    1. In your GitHub repository, go to the Actions tab. You should see the workflow running.
    2. In the Seenode Dashboard, navigate to your application’s Deployments tab. You should see a new deployment in progress.
  • Workflow Not Triggering: Ensure you are pushing to the correct branch specified in the on.push.branches section of your workflow file.
  • Authentication Error: Double-check that your SEENODE_API_TOKEN and SEENODE_APPLICATION_ID secrets are correct and have no extra spaces or characters.
  • Invalid Request: Verify the API endpoint in the curl command. Ensure the application ID is correct.