Preview Apps
Use these Github Actions to set up automatic deployment of Preview Apps from Github to Tapitalee.
Set up TAPIT_TOKEN secret
This is required to authorize Tapitalee to work in a Github Action.
In Tapitalee create a Deploy Token
$ tapit create deploy_token description='github'Copy the resulting toiken into a Github Secret under
Settings > Secrets and variables > Actions > New Repository Secret.
Deploy Preview App
Creates a preview app for pull requests that gets automatically deployed when PRs are opened, updated, or reopened.
# .github/workflows/deploy-preview.yml
name: Deploy Preview App
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create Preview app with Tapitalee
uses: tapitalee/ghactions/create-preview@staging
with:
tapit-token: ${{ secrets.TAPIT_TOKEN }}
preview_app_name: "myapp-pr-${{ github.event.pull_request.number }}"
delete_in_days: 1
domain: "pr-${{ github.event.pull_request.number }}.example.com"
- name: Deploy with Tapitalee
uses: tapitalee/ghactions/image-deploy@staging
with:
tapit-token: ${{ secrets.TAPIT_TOKEN }}
app_name: "myapp-pr-${{ github.event.pull_request.number }}"Delete Preview App
Automatically cleans up preview apps when pull requests are closed.
# .github/workflows/delete-preview.yml
name: Delete Preview App
on:
pull_request:
types: [closed]
jobs:
delete:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Delete Preview app with Tapitalee
uses: tapitalee/ghactions/delete-preview@staging
with:
tapit-token: ${{ secrets.TAPIT_TOKEN }}
preview_app_name: "myapp-pr-${{ github.event.pull_request.number }}"