Kam Exec #15
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
| name: Kam Exec | |
| permissions: | |
| contents: write | |
| actions: read | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| kam-command: | |
| description: Command to run | |
| required: false | |
| type: string | |
| default: cd MagicNet && kam build -a -s -r | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Cache Cargo & Rustup | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| ~/.rustup | |
| key: ${{ runner.os }}-rust-cache-${{ hashFiles('**/Cargo.lock') }}-${{ runner.os }}-v1 | |
| restore-keys: | | |
| ${{ runner.os }}-rust-cache- | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') || github.sha }}-v1 | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Cache JavaScript package manager caches (npm / yarn / pnpm / bun) | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| ~/.cache/yarn | |
| ~/.yarn/cache | |
| ~/.pnpm-store | |
| ~/.bun | |
| key: ${{ runner.os }}-js-cache-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml', '**/bun.lockb') || github.sha }}-v1 | |
| restore-keys: | | |
| ${{ runner.os }}-js-cache- | |
| - name: Setup kam | |
| uses: MemDeco-WG/setup-kam@main | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| enable-cache: "true" | |
| private-key: ${{ secrets.KAM_PRIVATE_KEY }} | |
| - name: Verify kam installation | |
| run: kam --version | |
| - name: Run kam command | |
| shell: bash | |
| run: | | |
| git submodule update --init --recursive | |
| git submodule update --remote --merge --recursive && git add . && git commit -m "Update all submodules to latest" && git push | |
| kam build --help | |
| rm -rf dist | |
| chmod +x hooks/**/* || chmod +x **/* | |
| chmod +x src/**/* || echo "-" | |
| echo "Executing: ${{ github.event.inputs.kam-command }}" | |
| ${{ github.event.inputs.kam-command }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Auto-commit changes | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: | | |
| chore: apply config - Template: ${{ github.event.inputs.template-url || 'No template' }} - Command: ${{ github.event.inputs.init-command || github.event.inputs.kam-command }} | |
| file_pattern: | | |
| * | |
| push_options: --force-with-lease | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |