Skip to content

chore(deps): bump the website-framework group across 1 directory with 4 updates #1781

chore(deps): bump the website-framework group across 1 directory with 4 updates

chore(deps): bump the website-framework group across 1 directory with 4 updates #1781

name: "CI - Bump Version & Create Tag"
on:
push:
branches:
- main
pull_request:
permissions:
contents: write
jobs:
version:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
# Full history: Changesets deepens a shallow clone (git fetch --deepen)
# to find each changeset's adding commit, which can hang in CI.
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Install pnpm
uses: pnpm/action-setup@v6
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install Poetry
uses: Gr1N/setup-poetry@v9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build core library
run: pnpm --filter @common-grants/core run build
- name: Build cli library
run: pnpm --filter @common-grants/cli run build
- name: Install python-sdk dependencies
working-directory: ./lib/python-sdk
run: poetry install
- name: Detect changesets
id: check_changesets
run: |
# Find changeset files
CHANGESET_FILES=$(find .changeset -type f -name "*.md" ! -name "README.md")
if [ -z "$CHANGESET_FILES" ]; then
echo "No changeset files found"
echo "found=false" >> $GITHUB_OUTPUT
exit 0
fi
# Inspect changeset files
echo "Found changeset files: $CHANGESET_FILES"
echo "found=true" >> $GITHUB_OUTPUT
PY_CHANGELOG=$(grep '"common-grants-sdk":' $CHANGESET_FILES || true)
if [ -z "$PY_CHANGELOG" ]; then
echo "found_py=false" >> $GITHUB_OUTPUT
exit 0
else
echo "found_py=true" >> $GITHUB_OUTPUT
# Multiple changesets can bump common-grants-sdk (e.g. a feature +
# a fix landing in the same release), so PY_CHANGELOG may be
# multiline — write it via the heredoc form, not key=value.
{
echo "py_changelog<<EOF"
echo "$PY_CHANGELOG"
echo "EOF"
} >> $GITHUB_OUTPUT
fi
- name: Bump version for Python package
working-directory: ./lib/python-sdk
if: steps.check_changesets.outputs.found_py == 'true'
run: |
CHANGELOG="${{ steps.check_changesets.outputs.py_changelog }}"
if [ -z "$CHANGELOG" ]; then
echo "No bump needed for Python package"
exit 0
elif echo "$CHANGELOG" | grep -q 'major'; then
echo "Major bump needed for Python package"
poetry version major
elif echo "$CHANGELOG" | grep -q 'minor'; then
echo "Minor bump needed for Python package"
poetry version minor
elif echo "$CHANGELOG" | grep -q 'patch'; then
echo "Patch bump needed for Python package"
poetry version patch
fi
- name: Bump version for Node package
if: steps.check_changesets.outputs.found == 'true'
run: |
pnpm changeset version
git status
- name: Commit bumped version
if: steps.check_changesets.outputs.found == 'true' && github.event_name != 'pull_request'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit --no-verify -m "chore: bump version [skip ci]" || echo "No changes to commit"
git push
- name: Create tag for Python package
if: steps.check_changesets.outputs.found_py == 'true'
working-directory: ./lib/python-sdk
run: |
PKG_NAME=$(poetry run tomlq -r .tool.poetry.name pyproject.toml)
PY_VERSION=$(poetry run tomlq -r .tool.poetry.version pyproject.toml)
git tag ${PKG_NAME}@${PY_VERSION}
echo "Added tag: ${PKG_NAME}@${PY_VERSION}"
- name: Create tag for Node package
if: steps.check_changesets.outputs.found == 'true'
run: pnpm changeset tag
- name: Push tags
if: steps.check_changesets.outputs.found == 'true' && github.event_name != 'pull_request'
run: git push --tags