Skip to content

Release

Release #3

Workflow file for this run

name: Release
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
id: extract-version
run: |
CURRENT_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "")
if [ -z "$CURRENT_TAG" ]; then
echo "No tag found at current commit. This workflow must be run from a tagged commit."
exit 1
fi
echo "Current tag: $CURRENT_TAG"
if [[ "$CURRENT_TAG" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
VERSION="${BASH_REMATCH[1]}"
echo "Detected version from tag: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "Invalid tag format: $CURRENT_TAG"
echo "Tag must be in semantic format (v1.2.3 or 1.2.3)"
exit 1
fi
ts-tests:
uses: ./.github/workflows/ts-tests.yml
with:
ref: ${{ github.ref }}
needs: release
pre-commit-checks:
uses: ./.github/workflows/enforce-pre-commit.yml
with:
ref: ${{ github.ref }}
needs: release
e2e-tests:
uses: ./.github/workflows/playwright.yml
with:
ref: ${{ github.ref }}
needs: release
python-tests:
uses: ./.github/workflows/python-tests.yml
with:
ref: ${{ github.ref }}
needs: release
build-and-deploy:
runs-on: ubuntu-latest
needs: [release, ts-tests, pre-commit-checks, e2e-tests, python-tests]
environment: release
env:
VERSION: ${{ needs.release.outputs.version }}
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: 'streamlit_pivot/frontend/package-lock.json'
- name: Install frontend dependencies
run: |
cd streamlit_pivot/frontend
npm ci
- name: Build frontend
run: |
cd streamlit_pivot/frontend
npm run build
- name: Build Python package
run: |
python -m pip install --upgrade pip build
python -m build
- name: Verify build artifacts
run: |
ls -la dist/
if [ ! -f "dist/streamlit_pivot-$VERSION-py3-none-any.whl" ]; then
echo "Expected wheel file not found"
exit 1
fi
if [ ! -f "dist/streamlit_pivot-$VERSION.tar.gz" ]; then
echo "Expected source distribution not found"
exit 1
fi
echo "Build artifacts verified"
- name: Store package artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: dist/
retention-days: 30
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
verbose: true
- name: Configure git for release
run: |
git config --global user.email "core+streamlitbot-github@streamlit.io"
git config --global user.name "Streamlit Bot"
- name: Create GitHub release
run: |
gh release create "v$VERSION" \
--title "Release v$VERSION" \
--notes "Release v$VERSION" \
--verify-tag \
dist/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release summary
if: always()
run: |
echo "Release v$VERSION completed successfully!"
echo "PyPI: https://pypi.org/project/streamlit-pivot/$VERSION/"
echo "GitHub: https://github.com/${{ github.repository }}/releases/tag/v$VERSION"