pin clawdbot sessions fix #25
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: Publish Docker Image | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| system: x86_64-linux | |
| suffix: amd64 | |
| - runner: ubuntu-24.04-arm64 | |
| system: aarch64-linux | |
| suffix: arm64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Nix | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| curl -fsSL https://install.determinate.systems/nix | sh -s -- install --no-confirm --nix-build-user-count 1 | |
| . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh | |
| nix --version | |
| - name: Resolve upstream version | |
| id: version | |
| run: | | |
| rev=$(grep -E 'rev\s*=\s*"' nix/sources/clawdbot-source.nix | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') | |
| if [ -z "$rev" ]; then | |
| echo "rev not found in nix/sources/clawdbot-source.nix" >&2 | |
| exit 1 | |
| fi | |
| echo "rev=$rev" >> "$GITHUB_OUTPUT" | |
| - name: Build image | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh | |
| nix build .#packages.${{ matrix.system }}.clawdbot-docker | |
| - name: Load image | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| docker load < result | |
| - name: Login to GHCR | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
| - name: Tag and push | |
| env: | |
| IMAGE: ghcr.io/clawdbot/clawdbot-gateway | |
| REV: ${{ steps.version.outputs.rev }} | |
| SUFFIX: ${{ matrix.suffix }} | |
| run: | | |
| docker tag clawdbot:latest "$IMAGE:latest-$SUFFIX" | |
| docker tag clawdbot:latest "$IMAGE:$REV-$SUFFIX" | |
| docker push "$IMAGE:latest-$SUFFIX" | |
| docker push "$IMAGE:$REV-$SUFFIX" |