[AD-PROJ-15] [AD-CLIENT-21] docs: add AGENTS.md and companion templates per Notion standards #20
Workflow file for this run
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: Version Check | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| permissions: | |
| contents: write | |
| jobs: | |
| check-version-sync: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.check.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Check version sync | |
| id: check | |
| run: | | |
| # Get version from pyproject.toml | |
| PYPROJECT_VERSION=$(uv version | awk '{print $2}') | |
| echo "pyproject.toml version: $PYPROJECT_VERSION" | |
| # Install package to verify dynamic version works | |
| uv sync | |
| # Get version from installed package (dynamic versioning) | |
| PACKAGE_VERSION=$(uv run python -c "from ryandata_address_utils import __version__; print(__version__)") | |
| echo "Package version: $PACKAGE_VERSION" | |
| # Compare versions | |
| if [ "$PYPROJECT_VERSION" != "$PACKAGE_VERSION" ]; then | |
| echo "❌ Version mismatch!" | |
| echo "pyproject.toml: $PYPROJECT_VERSION" | |
| echo "Package: $PACKAGE_VERSION" | |
| exit 1 | |
| fi | |
| echo "✅ Versions are in sync: $PYPROJECT_VERSION" | |
| echo "version=$PYPROJECT_VERSION" >> $GITHUB_OUTPUT | |
| create-tag-if-missing: | |
| needs: check-version-sync | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Debug version | |
| run: | | |
| echo "Version: '${{ needs.check-version-sync.outputs.version }}'" | |
| - name: Create tag if missing | |
| id: tag | |
| run: | | |
| VERSION="${{ needs.check-version-sync.outputs.version }}" | |
| echo "VERSION: '$VERSION'" | |
| if [ -z "$VERSION" ]; then | |
| echo "ERROR: VERSION is empty!" | |
| exit 1 | |
| fi | |
| TAG_NAME="v$VERSION" | |
| echo "Checking for tag: $TAG_NAME" | |
| echo "Existing tags:" | |
| git tag -l | |
| if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "Tag $TAG_NAME exists locally" | |
| echo "created=false" >> $GITHUB_OUTPUT | |
| elif git ls-remote --tags origin | grep -q "refs/tags/$TAG_NAME"; then | |
| echo "Tag $TAG_NAME exists on remote" | |
| echo "created=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Creating tag $TAG_NAME..." | |
| git tag -a "$TAG_NAME" -m "Release $TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| echo "Created tag $TAG_NAME" | |
| echo "created=true" >> $GITHUB_OUTPUT | |
| fi | |
| echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| if: steps.tag.outputs.created == 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag_name }} | |
| name: Release ${{ steps.tag.outputs.tag_name }} | |
| generate_release_notes: true | |
| prerelease: ${{ contains(needs.check-version-sync.outputs.version, 'a') || contains(needs.check-version-sync.outputs.version, 'b') || contains(needs.check-version-sync.outputs.version, 'rc') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |