Github Actions
Use these Github Actions to connect Tapitalee to Github.
As published below, these actions can be manually activated in the Actions
tab in Github. You can adjust them to suit your needs by consulting the Github documentation for Workflows.
Set up TAPIT_TOKEN
secret
This is required to authorize Tapitalee to work in a Github Action.
In Tapitalee App Settings, create a Deploy Token and copy its secret value into a Github Secret under Settings > Secrets and variables > Actions > New Repository Secret.
Automation
Manual deploys are defined by the workflow_dispatch:
section. To make it run when someone merges code to the main
branch, add this:
on:
push:
branches:
- master
Add the files below to your git repo as needed.
Build image only
When you may want to test building without actually deploying.
# .github/workflows/build.yml
name: Manual Build
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build using Tapit
uses: tapitalee/ghactions/image-build@main
with:
tapit-token: ${{ secrets.TAPIT_TOKEN }}
Build & deploy
Ideal for automating deploy on push to main.
# .github/workflows/deploy.yml
name: Manual Build & Deploy
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy using Tapit
uses: tapitalee/ghactions/image-deploy@main
with:
tapit-token: ${{ secrets.TAPIT_TOKEN }}
Run task
Allows running a command (eg. database migration). Note: This is for demo purposes only, do not use this on a public repository without additional security measures.
As configured, it will allow you to run a task from the Github Actions web interface, but you can modify it to run a specific command as needed, on the command:
line.
# .github/workflows/run.yml
name: Run Task
on:
workflow_dispatch:
inputs:
command:
description: 'Command'
required: true
type: string
memory:
description: 'Memory allocation in GB'
required: true
default: '1'
type: string
cpu:
description: 'CPU allocation in cores'
required: true
default: '0.25'
type: string
jobs:
run-task:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create Task
uses: tapitalee/ghactions/create-task@main
with:
tapit-token: ${{ secrets.TAPIT_TOKEN }}
memory: ${{ inputs.memory }}
cpu: ${{ inputs.cpu }}
command: ${{ inputs.command }}