Deploying with GitHub Actions
Learn how to set up automated deployments to seenode using GitHub Actions, including configuring secrets, creating workflows, and managing deployments.
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.
Prerequisites
- 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.
Getting an API Token
Learn how to generate and manage API tokens for authenticating with the seenode API.-
Add Secrets to GitHub
To keep your credentials secure, store them as encrypted secrets in your GitHub repository.
- In your GitHub repository, go to Settings > Secrets and variables > Actions.
- 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.
Tip
You can find your application ID in the URL of your application’s dashboard on seenode:
https://seenode.com/dashboard/applications?applicationId=969217→969217 -
Create the GitHub Actions Workflow
Create a workflow file in your repository to define the deployment job.
- Create a
.github/workflows/directory in your repository if it doesn’t already exist. - Inside this directory, create a new file named
deploy.yml. - Add the following content to the
deploy.ymlfile:
.github/workflows/deploy.yml name: Deploy to **seenode**on:push:branches:- main # Trigger the workflow on pushes to the main branchjobs:deploy:runs-on: ubuntu-lateststeps:- name: Trigger **seenode** Deploymentrun: |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
mainbranch. It sends a POST request to the seenode API to trigger a new deployment using the latest commit. - Create a
-
Commit and Push
Commit the new workflow file to your repository to activate it.
Terminal git add .github/workflows/deploy.ymlgit commit -m "ci: Add GitHub Action for **seenode** deployment"git push -
Verify the Deployment
Once you’ve pushed the workflow, you can verify that it’s working correctly.
- In your GitHub repository, go to the Actions tab. You should see the workflow running.
- In the seenode Dashboard, navigate to your application’s Deployments tab. You should see a new deployment in progress.
Troubleshooting
- Workflow Not Triggering: Ensure you are pushing to the correct branch specified in the
on.push.branchessection of your workflow file. - Authentication Error: Double-check that your
SEENODE_API_TOKENandSEENODE_APPLICATION_IDsecrets are correct and have no extra spaces or characters. - Invalid Request: Verify the API endpoint in the
curlcommand. Ensure the application ID is correct.