You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在GitHub CI/CD流水线及Linux终端运行PICO-8导出命令

Can I run PICO-8 export commands in a Linux terminal for GitHub CI/CD?

Yes, you absolutely can! PICO-8 offers a Linux command-line version that works perfectly in headless environments like GitHub's Ubuntu-based CI runners. Here's a step-by-step guide to implementing this in your pipeline:

1. Prepare PICO-8 in your CI environment

PICO-8 doesn't come pre-installed on GitHub runners, so you'll need to download and set it up during your workflow:

  • Download the Linux version of PICO-8 from the official Lexaloffle website (use wget or curl with the direct download URL for the Linux zip archive). For example:
    wget [YOUR_PICO8_LINUX_ZIP_URL]
    
  • Extract the archive to a directory in your runner workspace (replace the zip filename with your actual download):
    unzip pico-8_[your-version]_linux.zip -d pico-8
    
  • Make the PICO-8 executable file runnable:
    chmod +x pico-8/pico8
    

2. Add your PICO-8 license (if using a paid version)

If you're using a paid copy of PICO-8, you'll need to include your pico8_license.txt file in the PICO-8 directory to unlock full export functionality. You can store this file's content as a GitHub Secret and write it to the directory during the workflow:

echo "${{ secrets.PICO8_LICENSE }}" > pico-8/pico8_license.txt

3. Run the export command

Use the PICO-8 command-line interface to export your game for the web. The basic syntax is:

./pico-8/pico8 -export web path/to/your/game.p8

This will generate the necessary web player files (typically index.html, game.js, game.wasm, and related assets) in the same directory as your .p8 file. If you want to output to a specific folder (like dist for deployment), add the directory path after web:

./pico-8/pico8 -export web ./dist path/to/your/game.p8

4. Full GitHub CI/CD workflow example

Here's a complete .github/workflows/export-pico8-game.yml file that implements this pipeline. Make sure to replace placeholder values like [YOUR_PICO8_LINUX_ZIP_URL] and path/to/your/game.p8 with your actual details:

name: Export PICO-8 Game for Web
on: [push]

jobs:
  export-game:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Download and set up PICO-8
        run: |
          wget [YOUR_PICO8_LINUX_ZIP_URL]
          unzip pico-8_[your-version]_linux.zip -d pico-8
          chmod +x pico-8/pico8

      - name: Add PICO-8 License (Paid Version Only)
        if: env.PICO8_LICENSE
        run: echo "${{ secrets.PICO8_LICENSE }}" > pico-8/pico8_license.txt
        env:
          PICO8_LICENSE: ${{ secrets.PICO8_LICENSE }}

      - name: Export Web Player Files
        run: ./pico-8/pico8 -export web ./dist path/to/your/game.p8

      - name: Upload Exported Files as Artifact
        uses: actions/upload-artifact@v4
        with:
          name: pico8-web-player
          path: ./dist

Key Notes

  • Version Matching: Ensure the PICO-8 version you download matches the one you used to develop your game to avoid compatibility issues.
  • Headless Operation: PICO-8 automatically runs in headless mode when using command-line arguments like -export, so you don't need any GUI dependencies in the CI environment.
  • Free Version Limitations: The free version of PICO-8 supports web export but adds a small demo watermark to the game. Paid versions unlock full export capabilities without restrictions.

内容的提问来源于stack exchange,提问作者greg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 07:42:01