Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 2.18 KB

github-actions.mdx

File metadata and controls

61 lines (43 loc) · 2.18 KB
title Deploying your scripts with GitHub Actions
description Use the bunny.net deploy action to publish an Edge Script from a GitHub repository whenever your code changes.

The BunnyWay/actions/deploy-script action uploads a script to Edge Scripting as part of a GitHub workflow, so a push to the branch you choose publishes the script without anyone having to upload it by hand.

Example usage

This workflow deploys a script whenever something is pushed to the main branch:

name: Deploy when pushing on main

on:
  push:
    branches:
      - "main"

jobs:
  publish:
    runs-on: ubuntu-latest

    name: "Upload script"

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Deploy Script to Bunny Edge Scripting
        uses: BunnyWay/actions/deploy-script@main
        with:
          script_id: ${{ secrets.SCRIPT_ID }}
          deploy_key: ${{ secrets.DEPLOY_KEY }}
          file: "script.ts"

Inputs

The action takes three inputs:

  • script_id (required): the ID of the script you want to deploy. Store it as a GitHub secret (SCRIPT_ID).
  • deploy_key (required): the key that authorizes the deployment. Store it as a GitHub secret (DEPLOY_KEY).
  • file (required): the path of the script file to deploy. The file has to exist in your repository, or an earlier step in the workflow has to generate it.

The script ID and deploy key are available in the dashboard under Script -> Deployments -> Settings.

Place the workflow file in the .github/workflows folder in your repository, and adjust it to fit your own build and deployment pipeline. The official GitHub documentation covers workflow syntax in full.

Setting up secrets

To store the script_id and deploy_key as secrets in your GitHub repository:

  1. Navigate to your GitHub repository.
  2. Click on Settings.
  3. Select Secrets and variables.
  4. Choose Actions.
  5. Click New repository secret.
  6. Add SCRIPT_ID and DEPLOY_KEY as the names of the secrets and provide their respective values.