spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / .github / workflows / update-devcontainer-version.yml
62 lines · 2.4 KBRaw
1name: Update DevContainer Claude Code Version
2
3on:
4 schedule:
5 # Run daily at 00:00 UTC
6 - cron: '0 0 * * *'
7 workflow_dispatch: # Allow manual trigger
8
9jobs:
10 update-version:
11 runs-on: ubuntu-latest
12 permissions:
13 contents: write
14 pull-requests: write
15 steps:
16 - name: Checkout repository
17 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
18
19 - name: Get latest npm version
20 id: npm-version
21 run: |
22 LATEST_VERSION=$(npm view @anthropic-ai/claude-code version)
23 echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT
24 echo "Latest npm version: $LATEST_VERSION"
25
26 - name: Get current version from Dockerfile
27 id: current-version
28 run: |
29 CURRENT_VERSION=$(grep -oP 'ARG CLAUDE_CODE_VERSION=\K[^\s]+' .devcontainer/Dockerfile)
30 echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
31 echo "Current version: $CURRENT_VERSION"
32
33 - name: Update version if changed
34 if: steps.npm-version.outputs.version != steps.current-version.outputs.version
35 run: |
36 NEW_VERSION="${{ steps.npm-version.outputs.version }}"
37
38 # Update Dockerfile
39 sed -i "s/ARG CLAUDE_CODE_VERSION=.*/ARG CLAUDE_CODE_VERSION=$NEW_VERSION/" .devcontainer/Dockerfile
40
41 # Update devcontainer.json
42 sed -i "s/\"CLAUDE_CODE_VERSION\": \".*\"/\"CLAUDE_CODE_VERSION\": \"$NEW_VERSION\"/" .devcontainer/devcontainer.json
43
44 echo "Updated version to $NEW_VERSION"
45
46 - name: Create Pull Request
47 if: steps.npm-version.outputs.version != steps.current-version.outputs.version
48 uses: peter-evans/create-pull-request@v7
49 with:
50 commit-message: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}"
51 title: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}"
52 body: |
53 This PR automatically updates the claude-code version in the devcontainer configuration.
54
55 **Changes:**
56 - Updated `CLAUDE_CODE_VERSION` from `${{ steps.current-version.outputs.version }}` to `${{ steps.npm-version.outputs.version }}`
57
58 This ensures Docker cache is invalidated when rebuilding images, allowing users to get the latest claude-code version.
59
60 Related: #582
61 branch: chore/update-claude-code-version
62 delete-branch: true