|
| 1 | +# Static.app Deploy Action |
| 2 | + |
| 3 | +Deploy your static sites and built applications to [Static.app](https://static.app) directly from GitHub Actions. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- 🚀 **Easy deployment** - Deploy static sites with a single action |
| 8 | +- 🔧 **Build support** - Automatically build your application before deployment |
| 9 | +- 🆕 **Create or update** - Create new sites or update existing ones |
| 10 | +- 📦 **Smart packaging** - Automatically excludes unnecessary files |
| 11 | +- 🎯 **Flexible** - Works with any static site generator or build tool |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +### Basic Static Site Deployment |
| 16 | + |
| 17 | +```yaml |
| 18 | +name: Deploy to Static.app |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: [ main ] |
| 22 | + |
| 23 | +jobs: |
| 24 | + deploy: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v3 |
| 28 | + |
| 29 | + - name: Deploy to Static.app |
| 30 | + uses: designmodo/[email protected] |
| 31 | + with: |
| 32 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 33 | + build-dir: './' |
| 34 | +``` |
| 35 | +
|
| 36 | +### Deploy Built Application (React, Vue, etc.) |
| 37 | +
|
| 38 | +```yaml |
| 39 | +name: Deploy Built App |
| 40 | +on: |
| 41 | + push: |
| 42 | + branches: [ main ] |
| 43 | + |
| 44 | +jobs: |
| 45 | + deploy: |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v3 |
| 49 | + |
| 50 | + - name: Deploy to Static.app |
| 51 | + uses: designmodo/[email protected] |
| 52 | + with: |
| 53 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 54 | + build-dir: 'dist' |
| 55 | + build-command: 'npm run build' |
| 56 | + install-command: 'npm ci' |
| 57 | + node-version: '18' |
| 58 | +``` |
| 59 | +
|
| 60 | +### Update Existing Site (using PID) |
| 61 | +
|
| 62 | +```yaml |
| 63 | +name: Update Existing Site |
| 64 | +on: |
| 65 | + push: |
| 66 | + branches: [ main ] |
| 67 | + |
| 68 | +jobs: |
| 69 | + deploy: |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v3 |
| 73 | + |
| 74 | + - name: Deploy to Static.app |
| 75 | + uses: designmodo/[email protected] |
| 76 | + with: |
| 77 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 78 | + pid: 'ols2my1htk' |
| 79 | + build-dir: 'build' |
| 80 | + build-command: 'npm run build' |
| 81 | +``` |
| 82 | +
|
| 83 | +## Inputs |
| 84 | +
|
| 85 | +| Input | Description | Required | Default | |
| 86 | +|-------|-------------|----------|---------| |
| 87 | +| `api-key` | Your Static.app API key | ✅ | - | |
| 88 | +| `pid` | Project PID to update (find in Site → Settings → General) | ❌ | - | |
| 89 | +| `build-dir` | Directory to deploy | ❌ | `./` | |
| 90 | +| `build-command` | Build command to run before deployment | ❌ | - | |
| 91 | +| `install-command` | Install command to run before build | ❌ | `npm ci` | |
| 92 | +| `node-version` | Node.js version to use | ❌ | `18` | |
| 93 | +| `exclude` | Files/directories to exclude (comma-separated) | ❌ | `node_modules,.git,.github,*.md,package*.json` | |
| 94 | + |
| 95 | +## Outputs |
| 96 | + |
| 97 | +| Output | Description | |
| 98 | +|--------|-------------| |
| 99 | +| `site-url` | The URL of the deployed site | |
| 100 | +| `deploy-url` | The deployment URL | |
| 101 | + |
| 102 | +## Setup |
| 103 | + |
| 104 | +### 1. Get Your API Key |
| 105 | + |
| 106 | +1. Go to [Static.app](https://static.app) |
| 107 | +2. Sign in to your account |
| 108 | +3. Navigate to **Account → API Keys** |
| 109 | +4. Create a new API key |
| 110 | +5. Copy the generated key (starts with `sk_`) |
| 111 | + |
| 112 | +### 2. Add API Key to GitHub Secrets |
| 113 | + |
| 114 | +1. Go to your GitHub repository |
| 115 | +2. Navigate to **Settings → Secrets and variables → Actions** |
| 116 | +3. Click **New repository secret** |
| 117 | +4. Name: `STATIC_APP_API_KEY` |
| 118 | +5. Value: Your API key from Static.app |
| 119 | +6. Click **Add secret** |
| 120 | + |
| 121 | +### 3. Create Workflow File |
| 122 | + |
| 123 | +Create `.github/workflows/deploy.yml` in your repository: |
| 124 | + |
| 125 | +```yaml |
| 126 | +name: Deploy to Static.app |
| 127 | +
|
| 128 | +on: |
| 129 | + push: |
| 130 | + branches: [ main ] |
| 131 | +
|
| 132 | +jobs: |
| 133 | + deploy: |
| 134 | + runs-on: ubuntu-latest |
| 135 | + steps: |
| 136 | + - name: Checkout |
| 137 | + uses: actions/checkout@v3 |
| 138 | + |
| 139 | + - name: Deploy to Static.app |
| 140 | + uses: designmodo/[email protected] |
| 141 | + with: |
| 142 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 143 | + # Add other inputs as needed |
| 144 | +``` |
| 145 | + |
| 146 | +## Examples |
| 147 | + |
| 148 | +### React App |
| 149 | + |
| 150 | +```yaml |
| 151 | +- name: Deploy React App |
| 152 | + uses: designmodo/[email protected] |
| 153 | + with: |
| 154 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 155 | + build-dir: 'build' |
| 156 | + build-command: 'npm run build' |
| 157 | + install-command: 'npm ci' |
| 158 | +``` |
| 159 | + |
| 160 | +### Vue.js App |
| 161 | + |
| 162 | +```yaml |
| 163 | +- name: Deploy Vue App |
| 164 | + uses: designmodo/[email protected] |
| 165 | + with: |
| 166 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 167 | + build-dir: 'dist' |
| 168 | + build-command: 'npm run build' |
| 169 | +``` |
| 170 | + |
| 171 | +### Next.js Static Export |
| 172 | + |
| 173 | +```yaml |
| 174 | +- name: Deploy Next.js App |
| 175 | + uses: designmodo/[email protected] |
| 176 | + with: |
| 177 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 178 | + build-dir: 'out' |
| 179 | + build-command: 'npm run build && npm run export' |
| 180 | +``` |
| 181 | + |
| 182 | +### Gatsby |
| 183 | + |
| 184 | +```yaml |
| 185 | +- name: Deploy Gatsby Site |
| 186 | + uses: designmodo/[email protected] |
| 187 | + with: |
| 188 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 189 | + build-dir: 'public' |
| 190 | + build-command: 'npm run build' |
| 191 | +``` |
| 192 | + |
| 193 | +### Hugo |
| 194 | + |
| 195 | +```yaml |
| 196 | +- name: Deploy Hugo Site |
| 197 | + uses: designmodo/[email protected] |
| 198 | + with: |
| 199 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 200 | + build-dir: 'public' |
| 201 | + build-command: 'hugo --minify' |
| 202 | + install-command: 'echo "No npm install needed"' |
| 203 | +``` |
| 204 | + |
| 205 | +### Jekyll |
| 206 | + |
| 207 | +```yaml |
| 208 | +- name: Deploy Jekyll Site |
| 209 | + uses: designmodo/[email protected] |
| 210 | + with: |
| 211 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 212 | + build-dir: '_site' |
| 213 | + build-command: 'bundle exec jekyll build' |
| 214 | + install-command: 'bundle install' |
| 215 | +``` |
| 216 | + |
| 217 | +## Advanced Configuration |
| 218 | + |
| 219 | +### Custom Exclusions |
| 220 | + |
| 221 | +```yaml |
| 222 | +- name: Deploy with Custom Exclusions |
| 223 | + uses: designmodo/[email protected] |
| 224 | + with: |
| 225 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 226 | + exclude: 'node_modules,.git,*.log,temp,cache' |
| 227 | +``` |
| 228 | + |
| 229 | +### Multiple Node.js Versions |
| 230 | + |
| 231 | +```yaml |
| 232 | +strategy: |
| 233 | + matrix: |
| 234 | + node-version: [16, 18, 20] |
| 235 | +
|
| 236 | +- name: Deploy with Node ${{ matrix.node-version }} |
| 237 | + uses: designmodo/[email protected] |
| 238 | + with: |
| 239 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 240 | + node-version: ${{ matrix.node-version }} |
| 241 | +``` |
| 242 | + |
| 243 | +### Using Outputs |
| 244 | + |
| 245 | +```yaml |
| 246 | +- name: Deploy to Static.app |
| 247 | + id: deploy |
| 248 | + uses: designmodo/[email protected] |
| 249 | + with: |
| 250 | + api-key: ${{ secrets.STATIC_APP_API_KEY }} |
| 251 | +
|
| 252 | +- name: Comment PR with Deploy URL |
| 253 | + uses: actions/github-script@v6 |
| 254 | + with: |
| 255 | + script: | |
| 256 | + github.rest.issues.createComment({ |
| 257 | + issue_number: context.issue.number, |
| 258 | + owner: context.repo.owner, |
| 259 | + repo: context.repo.repo, |
| 260 | + body: '🚀 Deployed to: ${{ steps.deploy.outputs.site-url }}' |
| 261 | + }) |
| 262 | +``` |
| 263 | + |
| 264 | +## Troubleshooting |
| 265 | + |
| 266 | +### Common Issues |
| 267 | + |
| 268 | +**❌ "API key is required"** |
| 269 | +- Make sure you've added `STATIC_APP_API_KEY` to your repository secrets |
| 270 | +- Verify the secret name matches exactly |
| 271 | + |
| 272 | +**❌ "Build command failed"** |
| 273 | +- Check your build command syntax |
| 274 | +- Ensure all dependencies are properly installed |
| 275 | +- Verify the build directory exists after the build |
| 276 | + |
| 277 | +**❌ "Invalid API key"** |
| 278 | +- Regenerate your API key in Static.app dashboard |
| 279 | +- Update the GitHub secret with the new key |
| 280 | + |
| 281 | +**❌ "Site not found"** |
| 282 | +- If using `pid`, make sure the project exists and you have access |
| 283 | +- Remove `pid` to create a new site instead |
| 284 | + |
| 285 | +### Debug Mode |
| 286 | + |
| 287 | +Enable debug logging by adding this to your workflow: |
| 288 | + |
| 289 | +```yaml |
| 290 | +env: |
| 291 | + ACTIONS_STEP_DEBUG: true |
| 292 | +``` |
| 293 | + |
| 294 | +## Support |
| 295 | + |
| 296 | +- 📚 [Static.app Documentation](https://help.static.app/) |
| 297 | +- 📧 [Support Email](mailto:[email protected]) |
| 298 | + |
| 299 | +## License |
| 300 | + |
| 301 | +MIT License - see [LICENSE](LICENSE) file for details. |
| 302 | + |
| 303 | +--- |
| 304 | + |
| 305 | +Made with ❤️ by the [Static.app](https://static.app) team |
0 commit comments