move reusable code from generate to ai-enc #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2024-2026 Ronan LE MEILLAT | |
| # License: AGPL-3.0-or-later | |
| # | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU Affero General Public License as | |
| # published by the Free Software Foundation, either version 3 of the | |
| # License, or (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| # GNU Affero General Public License for more details. | |
| # | |
| # You should have received a copy of the GNU Affero General Public License | |
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| # | |
| name: FufuniMCPDeploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - apps/mcp/** | |
| - mcp/** | |
| - package-lock.json | |
| - .github/workflows/deploy-mcp.yaml | |
| - .github/workflows/create-env-artifact.yaml | |
| - scripts/generate-wrangler-jsonc.py | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| create-env: | |
| uses: ./.github/workflows/create-env-artifact.yaml | |
| secrets: inherit | |
| deploy: | |
| needs: create-env | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: "recursive" | |
| fetch-depth: 1 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| - name: Cache Turborepo | |
| uses: actions/cache@v5 | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo- | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Download shared .env artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: shared-env | |
| path: . | |
| # .env.enc was encrypted with openssl enc -aes-256-cbc -salt -in env_and_wrangler.tar.gz -out .env.enc -iter 10000 -pass pass:"${{ secrets.CRYPTOKEN }}" | |
| - name: Decrypt .env + wrangler.jsonc artifact | |
| run: | | |
| openssl enc -aes-256-cbc -d -salt -in .env.enc -out env_and_wrangler.tar.gz -iter 10000 -pass pass:"${{ secrets.CRYPTOKEN }}" | |
| tar -xzvf env_and_wrangler.tar.gz | |
| rm env_and_wrangler.tar.gz .env.enc | |
| if [ ! -f apps/mcp/wrangler.jsonc ]; then | |
| echo "Decrypted artifact does not contain apps/mcp/wrangler.jsonc" | |
| exit 1 | |
| fi | |
| if [ ! -f apps/mcp/secrets.json ]; then | |
| echo "Decrypted artifact does not contain apps/mcp/secrets.json" | |
| exit 1 | |
| fi | |
| - name: Set Wrangler secrets in bulk from secrets.json | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| run: | | |
| cd apps/mcp | |
| npx wrangler secret bulk < secrets.json | |
| - name: Deploy MCP Worker | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: apps/mcp | |
| preCommands: npm run gen-knowledge |