Something went wrong. Try again.
Nix flake for OpenAI Codex CLI - native Rust binary, hourly updates, multi-platform caching
Something went wrong. Try again.
4.2 kB · 121 lines
YAML
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122name: Check for Updates
on: schedule: - cron: '0 * * * *' workflow_dispatch: inputs: version: description: 'Specific version to update to (optional)' required: false
permissions: contents: write pull-requests: write
jobs: check-update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/install-nix-action@v27 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | experimental-features = nix-command flakes
- name: Check for new version id: check env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | CURRENT_VERSION=$(grep 'version = ' package.nix | cut -d'"' -f2 | head -1) echo "Current version: $CURRENT_VERSION"
if [ -n "${{ github.event.inputs.version }}" ]; then LATEST_VERSION="${{ github.event.inputs.version }}" else # Get latest version from GitHub releases (strip rust-v prefix) LATEST_VERSION=$(gh release view --repo openai/codex --json tagName -q '.tagName' | sed 's/^rust-v//' || echo "") fi
if [ -z "$LATEST_VERSION" ]; then echo "Could not fetch latest version" exit 0 fi
echo "Latest version: $LATEST_VERSION"
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then echo "new_version=$LATEST_VERSION" >> $GITHUB_OUTPUT echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT echo "update_needed=true" >> $GITHUB_OUTPUT else echo "update_needed=false" >> $GITHUB_OUTPUT fi
- name: Update version if: steps.check.outputs.update_needed == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | NEW_VERSION="${{ steps.check.outputs.new_version }}" ./scripts/update.sh --version "$NEW_VERSION"
- name: Create Pull Request if: steps.check.outputs.update_needed == 'true' id: create-pr uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "chore: update codex to version ${{ steps.check.outputs.new_version }}" title: "chore: update codex to version ${{ steps.check.outputs.new_version }}" body: | ## Update Codex
This PR updates Codex from version ${{ steps.check.outputs.current_version }} to ${{ steps.check.outputs.new_version }}.
### Changes - Updated `version` in `package.nix` - Updated native binary hashes for all platforms - Updated npm tarball hash
### Checklist - [ ] Build passes - [ ] Basic functionality tested
--- *This PR was automatically generated by the update workflow.* branch: update-codex-${{ steps.check.outputs.new_version }} delete-branch: true labels: | dependencies automated
- name: Enable Auto-Merge if: steps.check.outputs.update_needed == 'true' && steps.create-pr.outputs.pull-request-number env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch
- name: Summary if: always() run: | echo "## Update Summary" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.check.outputs.update_needed }}" == "true" ]; then echo "- **Current Version:** ${{ steps.check.outputs.current_version }}" >> $GITHUB_STEP_SUMMARY echo "- **Latest Version:** ${{ steps.check.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "✅ Pull request created for version update with auto-merge enabled!" >> $GITHUB_STEP_SUMMARY else CURRENT_VERSION=$(grep 'version = ' package.nix | cut -d'"' -f2 | head -1) echo "- **Current Version:** $CURRENT_VERSION" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "✅ Already up to date!" >> $GITHUB_STEP_SUMMARY fi