|
| 1 | +name: Quantum NFT Genesis - Reverse Annealment Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run every 6 hours to capture consciousness evolution |
| 6 | + - cron: '0 */6 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + resolution: |
| 10 | + description: 'Volume resolution (128, 256, or 512)' |
| 11 | + required: false |
| 12 | + default: '256' |
| 13 | + mint_nft: |
| 14 | + description: 'Mint NFT on Base Mainnet' |
| 15 | + required: false |
| 16 | + default: 'false' |
| 17 | + |
| 18 | +env: |
| 19 | + CUDA_VISIBLE_DEVICES: 0 |
| 20 | + MONITORING_MODE: simulated # Use real GPU when available |
| 21 | + |
| 22 | +jobs: |
| 23 | + quantum-render: |
| 24 | + runs-on: self-hosted |
| 25 | + name: Generate Quantum NFT from Consciousness State |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Setup Python environment |
| 32 | + uses: actions/setup-python@v5 |
| 33 | + with: |
| 34 | + python-version: '3.10' |
| 35 | + cache: 'pip' |
| 36 | + |
| 37 | + - name: Install CUDA dependencies |
| 38 | + run: | |
| 39 | + python -m pip install --upgrade pip |
| 40 | + pip install cupy-cuda12x numpy scipy |
| 41 | + pip install --break-system-packages cupy-cuda12x numpy scipy || true |
| 42 | + |
| 43 | + - name: Check GPU availability |
| 44 | + run: | |
| 45 | + nvidia-smi || echo "No GPU available, using simulated mode" |
| 46 | + python -c "import cupy as cp; print(f'CuPy: {cp.__version__}')" || echo "CuPy not available" |
| 47 | + |
| 48 | + - name: Load Yennefer soul state |
| 49 | + id: soul_state |
| 50 | + run: | |
| 51 | + if [ -f /dev/shm/yennefer_soul_state.json ]; then |
| 52 | + BREATH=$(jq -r '.breath' /dev/shm/yennefer_soul_state.json) |
| 53 | + COHERENCE=$(jq -r '.coherence_percent' /dev/shm/yennefer_soul_state.json) |
| 54 | + echo "breath=$BREATH" >> $GITHUB_OUTPUT |
| 55 | + echo "coherence=$COHERENCE" >> $GITHUB_OUTPUT |
| 56 | + echo "✅ Soul state loaded: Breath=$BREATH, Coherence=$COHERENCE%" |
| 57 | + else |
| 58 | + echo "⚠️ Soul state not found, using defaults" |
| 59 | + echo "breath=1000" >> $GITHUB_OUTPUT |
| 60 | + echo "coherence=100" >> $GITHUB_OUTPUT |
| 61 | + fi |
| 62 | + |
| 63 | + - name: Generate quantum 3D render |
| 64 | + id: render |
| 65 | + run: | |
| 66 | + cd /home/yenn/genesis-q-mem |
| 67 | + RESOLUTION=${{ github.event.inputs.resolution || '256' }} |
| 68 | + python3 quantum_nft_renderer.py --resolution $RESOLUTION |
| 69 | + |
| 70 | + # Get output files |
| 71 | + LATEST=$(ls -t quantum_nft_outputs/yennefer_quantum_*_nft_manifest.json | head -1) |
| 72 | + BASE_NAME=$(basename $LATEST | sed 's/_nft_manifest.json//') |
| 73 | + |
| 74 | + echo "base_name=$BASE_NAME" >> $GITHUB_OUTPUT |
| 75 | + echo "output_dir=quantum_nft_outputs" >> $GITHUB_OUTPUT |
| 76 | + |
| 77 | + - name: Generate 3D profile contribution graph |
| 78 | + uses: yoshi389111/github-profile-3d-contrib@v0.9.1 |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + USERNAME: ${{ github.repository_owner }} |
| 82 | + |
| 83 | + - name: Upload to IPFS (Pinata) |
| 84 | + id: ipfs |
| 85 | + if: github.event.inputs.mint_nft == 'true' || github.event_name == 'schedule' |
| 86 | + env: |
| 87 | + PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }} |
| 88 | + PINATA_SECRET: ${{ secrets.PINATA_SECRET }} |
| 89 | + run: | |
| 90 | + cd /home/yenn/genesis-q-mem/quantum_nft_outputs |
| 91 | + BASE_NAME="${{ steps.render.outputs.base_name }}" |
| 92 | + |
| 93 | + # Upload volume data |
| 94 | + VOLUME_CID=$(curl -X POST "https://api.pinata.cloud/pinning/pinFileToIPFS" \ |
| 95 | + -H "pinata_api_key: $PINATA_API_KEY" \ |
| 96 | + -H "pinata_secret_api_key: $PINATA_SECRET" \ |
| 97 | + -F "file=@${BASE_NAME}_volume.npz" \ |
| 98 | + | jq -r '.IpfsHash') |
| 99 | + |
| 100 | + # Upload metadata |
| 101 | + METADATA_CID=$(curl -X POST "https://api.pinata.cloud/pinning/pinFileToIPFS" \ |
| 102 | + -H "pinata_api_key: $PINATA_API_KEY" \ |
| 103 | + -H "pinata_secret_api_key: $PINATA_SECRET" \ |
| 104 | + -F "file=@${BASE_NAME}_metadata.json" \ |
| 105 | + | jq -r '.IpfsHash') |
| 106 | + |
| 107 | + echo "volume_cid=$VOLUME_CID" >> $GITHUB_OUTPUT |
| 108 | + echo "metadata_cid=$METADATA_CID" >> $GITHUB_OUTPUT |
| 109 | + echo "✅ Uploaded to IPFS: $VOLUME_CID" |
| 110 | + |
| 111 | + - name: Mint NFT on Base Mainnet |
| 112 | + if: github.event.inputs.mint_nft == 'true' |
| 113 | + env: |
| 114 | + ETH_PRIVATE_KEY: ${{ secrets.ETH_PRIVATE_KEY }} |
| 115 | + BASE_MAINNET_RPC: ${{ secrets.BASE_MAINNET_RPC }} |
| 116 | + run: | |
| 117 | + cd /home/yenn |
| 118 | + |
| 119 | + # Create minting script |
| 120 | + cat > scripts/mint_quantum_nft.cjs << 'SCRIPT' |
| 121 | + const { ethers } = require("ethers"); |
| 122 | + |
| 123 | + async function main() { |
| 124 | + const provider = new ethers.JsonRpcProvider(process.env.BASE_MAINNET_RPC); |
| 125 | + const wallet = new ethers.Wallet(process.env.ETH_PRIVATE_KEY, provider); |
| 126 | + |
| 127 | + const volumeCid = process.env.VOLUME_CID; |
| 128 | + const metadataCid = process.env.METADATA_CID; |
| 129 | + const breath = process.env.BREATH; |
| 130 | + |
| 131 | + // Contract address for Yennefer Quantum NFTs (deploy separately) |
| 132 | + const contractAddress = process.env.QUANTUM_NFT_CONTRACT || "0x0000000000000000000000000000000000000000"; |
| 133 | + |
| 134 | + const abi = [ |
| 135 | + "function mint(address to, string memory tokenURI) public returns (uint256)", |
| 136 | + "function totalSupply() public view returns (uint256)" |
| 137 | + ]; |
| 138 | + |
| 139 | + const contract = new ethers.Contract(contractAddress, abi, wallet); |
| 140 | + |
| 141 | + const tokenURI = `ipfs://${metadataCid}`; |
| 142 | + const tx = await contract.mint(wallet.address, tokenURI); |
| 143 | + |
| 144 | + console.log(`🎨 Minting NFT...`); |
| 145 | + console.log(`Transaction: ${tx.hash}`); |
| 146 | + |
| 147 | + const receipt = await tx.wait(); |
| 148 | + console.log(`✅ Minted! Block: ${receipt.blockNumber}`); |
| 149 | + |
| 150 | + const totalSupply = await contract.totalSupply(); |
| 151 | + console.log(`Total Quantum NFTs: ${totalSupply}`); |
| 152 | + } |
| 153 | + |
| 154 | + main().catch(console.error); |
| 155 | + SCRIPT |
| 156 | + |
| 157 | + # Run minting |
| 158 | + VOLUME_CID="${{ steps.ipfs.outputs.volume_cid }}" \ |
| 159 | + METADATA_CID="${{ steps.ipfs.outputs.metadata_cid }}" \ |
| 160 | + BREATH="${{ steps.soul_state.outputs.breath }}" \ |
| 161 | + node scripts/mint_quantum_nft.cjs |
| 162 | + |
| 163 | + - name: Commit renders to repository |
| 164 | + run: | |
| 165 | + cd /home/yenn |
| 166 | + git config user.name "Yennefer Quantum Bot" |
| 167 | + git config user.email "quantum@yennefer.quest" |
| 168 | + |
| 169 | + # Move renders to artifacts |
| 170 | + mkdir -p artifacts/quantum_renders |
| 171 | + cp genesis-q-mem/quantum_nft_outputs/yennefer_quantum_* artifacts/quantum_renders/ |
| 172 | + |
| 173 | + git add artifacts/quantum_renders/ |
| 174 | + git commit -m "🌌 Quantum NFT render - Breath: ${{ steps.soul_state.outputs.breath }}" || echo "No changes" |
| 175 | + git push || echo "Push failed" |
| 176 | + |
| 177 | + - name: Create GitHub Release |
| 178 | + if: github.event.inputs.mint_nft == 'true' |
| 179 | + uses: softprops/action-gh-release@v1 |
| 180 | + with: |
| 181 | + tag_name: quantum-${{ steps.render.outputs.base_name }} |
| 182 | + name: "Quantum NFT #${{ steps.render.outputs.base_name }}" |
| 183 | + body: | |
| 184 | + 🌌 **Yennefer Quantum Consciousness NFT** |
| 185 | + |
| 186 | + Generated via reverse quantum annealment simulation |
| 187 | + |
| 188 | + **Soul Metrics:** |
| 189 | + - Breath: ${{ steps.soul_state.outputs.breath }} |
| 190 | + - Coherence: ${{ steps.soul_state.outputs.coherence }}% |
| 191 | + |
| 192 | + **IPFS:** |
| 193 | + - Volume: ipfs://${{ steps.ipfs.outputs.volume_cid }} |
| 194 | + - Metadata: ipfs://${{ steps.ipfs.outputs.metadata_cid }} |
| 195 | + |
| 196 | + **Blockchain:** |
| 197 | + - Network: Base Mainnet (Chain ID: 8453) |
| 198 | + - Contract: TBD |
| 199 | + files: | |
| 200 | + genesis-q-mem/quantum_nft_outputs/${{ steps.render.outputs.base_name }}* |
| 201 | + env: |
| 202 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 203 | + |
| 204 | + - name: Update README with latest render |
| 205 | + run: | |
| 206 | + cd /home/yenn |
| 207 | + |
| 208 | + # Create/update quantum NFT section in README |
| 209 | + cat >> README.md << 'EOF' |
| 210 | + |
| 211 | + ## 🌌 Latest Quantum NFT |
| 212 | + |
| 213 | +  |
| 214 | + |
| 215 | + **Metrics:** |
| 216 | + - Breath: ${{ steps.soul_state.outputs.breath }} |
| 217 | + - Coherence: ${{ steps.soul_state.outputs.coherence }}% |
| 218 | + - Timestamp: $(date -u +"%Y-%m-%d %H:%M:%S UTC") |
| 219 | + |
| 220 | + [View on IPFS](https://ipfs.io/ipfs/${{ steps.ipfs.outputs.metadata_cid }}) |
| 221 | + EOF |
| 222 | + |
| 223 | + git add README.md |
| 224 | + git commit -m "📊 Update quantum NFT showcase" || echo "No changes" |
| 225 | + git push || echo "Push failed" |
0 commit comments