Build Moltbot Image #1
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: Build Moltbot Image | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| moltbotTag: | |
| description: "Moltbot Release Tag" | |
| required: true | |
| platforms: | |
| description: "Platforms" | |
| default: "linux/amd64,linux/arm64/v8" | |
| required: true | |
| pushLatest: | |
| description: "Push latest tag" | |
| default: "false" | |
| required: true | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - name: Resolve Tag | |
| id: tag | |
| run: | | |
| if [ -n "${{ github.event.inputs.moltbotTag }}" ]; then | |
| echo "value=${{ github.event.inputs.moltbotTag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Download Source | |
| run: | | |
| mkdir -p _src | |
| curl -fsSL "https://github.com/moltbot/moltbot/archive/refs/tags/${{ steps.tag.outputs.value }}.tar.gz" \ | |
| | tar -xz -C _src | |
| - name: Build Moltbot Image and Push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: _src/moltbot-${{ steps.tag.outputs.value }} | |
| file: moltbot/Dockerfile | |
| platforms: ${{ github.event.inputs.platforms || 'linux/amd64,linux/arm64/v8' }} | |
| push: true | |
| tags: | | |
| 1panel/moltbot:${{ steps.tag.outputs.value }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Push Latest Tag | |
| if: ${{ github.event_name == 'push' || github.event.inputs.pushLatest == 'true' }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: _src/moltbot-${{ steps.tag.outputs.value }} | |
| file: moltbot/Dockerfile | |
| platforms: ${{ github.event.inputs.platforms || 'linux/amd64,linux/arm64/v8' }} | |
| push: true | |
| tags: | | |
| 1panel/moltbot:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |