Skip to content

fix: Use streamlit secrets for AWS config #19

fix: Use streamlit secrets for AWS config

fix: Use streamlit secrets for AWS config #19

Workflow file for this run

name: Release
on:
push:
branches: [master]
permissions:
contents: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
# Skip release for commits that only update version (avoid infinite loop)
if: "!contains(github.event.head_commit.message, 'chore(release):')"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for changelog generation
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.13
- name: Install dependencies
run: uv sync --dev
- name: Run tests
run: |
uv run pytest tests/ -v --tb=short -x --ignore=tests/test_smoke.py
- name: Get current version
id: current_version
run: |
VERSION=$(grep -oP 'version = "\K[^"]+' pyproject.toml)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Determine version bump
id: bump
run: |
# Get commits since last tag (or all commits if no tags exist)
if git describe --tags --abbrev=0 2>/dev/null; then
LAST_TAG=$(git describe --tags --abbrev=0)
COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=format:"%s")
else
# No tags yet - analyze the current commit only
COMMITS=$(git log -1 --pretty=format:"%s")
fi
echo "Analyzing commits for version bump..."
echo "$COMMITS"
# Determine bump type based on conventional commits
BUMP="none"
if echo "$COMMITS" | grep -qiE "^BREAKING CHANGE:|^[a-z]+(\(.+\))?!:"; then
BUMP="major"
elif echo "$COMMITS" | grep -qiE "^feat(\(.+\))?:"; then
BUMP="minor"
elif echo "$COMMITS" | grep -qiE "^fix(\(.+\))?:|^perf(\(.+\))?:|^refactor(\(.+\))?:"; then
BUMP="patch"
fi
echo "bump=$BUMP" >> $GITHUB_OUTPUT
- name: Calculate new version
id: new_version
if: steps.bump.outputs.bump != 'none'
run: |
CURRENT="${{ steps.current_version.outputs.version }}"
BUMP="${{ steps.bump.outputs.bump }}"
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
case $BUMP in
major)
NEW_VERSION="$((MAJOR + 1)).0.0"
;;
minor)
NEW_VERSION="${MAJOR}.$((MINOR + 1)).0"
;;
patch)
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
;;
esac
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "Bumping from $CURRENT to $NEW_VERSION ($BUMP)"
- name: Generate changelog
id: changelog
if: steps.bump.outputs.bump != 'none'
run: |
# Get commits since last tag
if git describe --tags --abbrev=0 2>/dev/null; then
LAST_TAG=$(git describe --tags --abbrev=0)
COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=format:"- %s (%h)" --reverse)
else
COMMITS=$(git log -1 --pretty=format:"- %s (%h)")
fi
# Create changelog grouped by type
FEATURES=$(echo "$COMMITS" | grep -iE "^- feat" || true)
FIXES=$(echo "$COMMITS" | grep -iE "^- fix" || true)
PERF=$(echo "$COMMITS" | grep -iE "^- perf" || true)
REFACTOR=$(echo "$COMMITS" | grep -iE "^- refactor" || true)
OTHER=$(echo "$COMMITS" | grep -viE "^- (feat|fix|perf|refactor|chore|docs|style|test|ci|build)" || true)
CHANGELOG=""
if [ -n "$FEATURES" ]; then
CHANGELOG="${CHANGELOG}### ✨ Features\n${FEATURES}\n\n"
fi
if [ -n "$FIXES" ]; then
CHANGELOG="${CHANGELOG}### 🐛 Bug Fixes\n${FIXES}\n\n"
fi
if [ -n "$PERF" ]; then
CHANGELOG="${CHANGELOG}### ⚡ Performance\n${PERF}\n\n"
fi
if [ -n "$REFACTOR" ]; then
CHANGELOG="${CHANGELOG}### ♻️ Refactoring\n${REFACTOR}\n\n"
fi
if [ -n "$OTHER" ]; then
CHANGELOG="${CHANGELOG}### 📝 Other Changes\n${OTHER}\n\n"
fi
# Write to file for multiline handling
echo -e "$CHANGELOG" > /tmp/changelog.md
# Also output for debugging
echo "Generated changelog:"
cat /tmp/changelog.md
- name: Update version in pyproject.toml and uv.lock
if: steps.bump.outputs.bump != 'none'
run: |
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
sed -i "s/version = \".*\"/version = \"$NEW_VERSION\"/" pyproject.toml
# Update uv.lock to reflect the new version
uv lock
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pyproject.toml uv.lock
git commit -m "chore(release): v$NEW_VERSION"
git push
- name: Create Git tag
if: steps.bump.outputs.bump != 'none'
run: |
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
git tag "v$NEW_VERSION"
git push origin "v$NEW_VERSION"
- name: Create GitHub Release
if: steps.bump.outputs.bump != 'none'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.new_version.outputs.new_version }}
name: v${{ steps.new_version.outputs.new_version }}
body_path: /tmp/changelog.md
generate_release_notes: true # Adds contributors and full changelog link
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Skip release
if: steps.bump.outputs.bump == 'none'
run: |
echo "No version bump needed. Commit message does not follow conventional commits format."
echo "Use prefixes like: feat:, fix:, perf:, refactor:, or BREAKING CHANGE:"