feat: install Helm #93
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 Image | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| - 'latest' | |
| pull_request: | |
| branches: | |
| - 'master' | |
| - 'main' | |
| paths-ignore: | |
| - 'README.md' | |
| workflow_dispatch: | |
| inputs: | |
| openclaw-image-version: | |
| description: 'OpenClaw base image version:' | |
| required: true | |
| default: 'latest' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| OPENCLAW_IMAGE_VERSION: ${{ github.event.inputs.openclaw-image-version || 'latest' }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| # https://github.com/marketplace/actions/docker-setup-qemu | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3.0.0 | |
| - name: Setup Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3.0.0 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get OpenClaw Image Version | |
| if: ${{ env.OPENCLAW_IMAGE_VERSION == 'latest' }} | |
| id: openclaw-version | |
| run: | | |
| LATEST_VERSION=$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s https://api.github.com/orgs/openclaw/packages/container/openclaw/versions?per_page=200 | jq -r '[.[] | .metadata.container.tags[]? | select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$"))] | unique | sort_by(split(".") | map(tonumber)) | last' ) | |
| if [ -z "$LATEST_VERSION" ] || [ "$LATEST_VERSION" = "null" ]; then | |
| LATEST_VERSION=latest | |
| fi | |
| echo "Resolved OpenClaw image version: $LATEST_VERSION" | |
| echo "OPENCLAW_IMAGE_VERSION=$LATEST_VERSION" >> $GITHUB_ENV | |
| # https://github.com/marketplace/actions/docker-metadata-action | |
| - name: Meta | |
| id: meta | |
| uses: docker/metadata-action@v5.5.0 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=tag | |
| type=raw,event=pr,value=dev | |
| annotations: | | |
| org.opencontainers.image.base.name=openclaw:${{ env.OPENCLAW_IMAGE_VERSION }} | |
| org.opencontainers.image.title=OpenClaw | |
| org.opencontainers.image.description=Custom OpenClaw image with pre-installed extra dependencies | |
| - name: Inspect Tags | |
| run: echo "${{ steps.meta.outputs.tags }}" | |
| - name: Inspect Labels | |
| run: echo "${{ steps.meta.outputs.labels }}" | |
| - name: Inspect Annotations | |
| run: echo "${{ steps.meta.outputs.annotations }}" | |
| # https://github.com/marketplace/actions/build-and-push-docker-images | |
| - name: Build and push Docker images | |
| uses: docker/build-push-action@v5.1.0 | |
| with: | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| push: true | |
| platforms: linux/amd64 | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| build-args: | | |
| OPENCLAW_IMAGE_VERSION=${{ env.OPENCLAW_IMAGE_VERSION }} | |
| - name: Update README Badge | |
| if: ${{ success() && github.ref_type != 'tag' && env.OPENCLAW_IMAGE_VERSION != '' && env.OPENCLAW_IMAGE_VERSION != 'null' && env.OPENCLAW_IMAGE_VERSION != 'latest' }} | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git fetch origin | |
| git checkout $GITHUB_HEAD_REF | |
| sed -i "s/OpenClaw%20Image-v[0-9.]*-green/OpenClaw%20Image-v${{ env.OPENCLAW_IMAGE_VERSION }}-green/" README.md | |
| git add README.md | |
| git diff --cached --quiet || git commit -m "Update badge with OpenClaw Image version ${{ env.OPENCLAW_IMAGE_VERSION }}" | |
| git push origin $GITHUB_HEAD_REF | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |