Something went wrong. Try again.
Nix flake for OpenAI Codex CLI - native Rust binary, hourly updates, multi-platform caching
Something went wrong. Try again.
3.2 kB · 88 lines
YAML
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889name: Create Version Tag
on: workflow_run: workflows: ["Build and Cache"] types: [completed] branches: [main]
permissions: contents: write
jobs: create-tag: if: github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0
- name: Extract version from package.nix id: version run: | VERSION=$(sed -n 's/.*version = "\([^"]*\)".*/\1/p' package.nix | head -1) echo "version=$VERSION" >> $GITHUB_OUTPUT echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Check if tag exists id: check-tag run: | if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then echo "exists=true" >> $GITHUB_OUTPUT else echo "exists=false" >> $GITHUB_OUTPUT fi
- name: Configure git run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create and push version tag if: steps.check-tag.outputs.exists == 'false' run: | git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}" git push origin "v${{ steps.version.outputs.version }}"
- name: Extract major version id: major run: | MAJOR=$(echo "${{ steps.version.outputs.version }}" | cut -d. -f1) echo "major=$MAJOR" >> $GITHUB_OUTPUT
- name: Update moving tags run: | VERSION="${{ steps.version.outputs.version }}" MAJOR="${{ steps.major.outputs.major }}"
# Delete remote tags if they exist (moving tags need force update) git push origin :refs/tags/latest 2>/dev/null || true git push origin :refs/tags/v$MAJOR 2>/dev/null || true
# Delete local tags if they exist git tag -d latest 2>/dev/null || true git tag -d v$MAJOR 2>/dev/null || true
# Create new annotated tags git tag -a "latest" -m "Latest release: v$VERSION" git tag -a "v$MAJOR" -m "Latest v$MAJOR release: v$VERSION"
# Push the moving tags git push origin latest git push origin "v$MAJOR"
- name: Summary run: | echo "## Tag Summary" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "| Tag | Points To |" >> $GITHUB_STEP_SUMMARY echo "|-----|-----------|" >> $GITHUB_STEP_SUMMARY if [ "${{ steps.check-tag.outputs.exists }}" == "false" ]; then echo "| v${{ steps.version.outputs.version }} | $(git rev-parse --short HEAD) |" >> $GITHUB_STEP_SUMMARY else echo "| v${{ steps.version.outputs.version }} | (already exists) |" >> $GITHUB_STEP_SUMMARY fi echo "| v${{ steps.major.outputs.major }} | v${{ steps.version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY echo "| latest | v${{ steps.version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY