Skip to content

Release v0.0.90

Release v0.0.90 #160

Workflow file for this run

name: "Publish Release"
on:
pull_request:
types: [closed]
branches: [main]
jobs:
publish:
# Only run if PR was merged AND it's a release branch
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # Required for PyPI and npm OIDC trusted publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper release notes generation
- name: Fetch all tags
run: git fetch --tags --force
- name: Get version from branch name
id: version
run: |
# Extract version from branch name (release/v1.2.3 -> 1.2.3)
BRANCH="${{ github.event.pull_request.head.ref }}"
VERSION="${BRANCH#release/v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"
#
# Setup
#
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Hatch
run: |
pip install hatch 'virtualenv!=21.0.0'
- uses: actions/setup-node@v4
with:
node-version: '24' # Node 24+ includes npm 11.5.1+ required for OIDC trusted publishing
registry-url: 'https://registry.npmjs.org'
#
# Build Python packages
#
- name: Build DJ Server
working-directory: ./datajunction-server
run: hatch build
# TODO: Uncomment when we have PyPI ownership of datajunction-query
# - name: Build DJ Query service
# working-directory: ./datajunction-query
# run: hatch build
- name: Build DJ Reflection service
working-directory: ./datajunction-reflection
run: hatch build
- name: Build DJ Python client
working-directory: ./datajunction-clients/python
run: hatch build
#
# Publish Python packages to PyPI (using OIDC trusted publishing)
#
- name: Publish DJ Server to PyPI
continue-on-error: true
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: datajunction-server/dist/
# TODO: Uncomment when we have PyPI ownership of datajunction-query
# - name: Publish DJ Query service to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# packages-dir: datajunction-query/dist/
- name: Publish DJ Reflection service to PyPI
continue-on-error: true
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: datajunction-reflection/dist/
- name: Publish DJ Python client to PyPI
continue-on-error: true
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: datajunction-clients/python/dist/
#
# Publish JavaScript packages to npm (using OIDC trusted publishing)
# NOTE: Each package must be configured on npmjs.com:
# Package Settings → Trusted Publisher → GitHub Actions
# Organization: DataJunction, Repository: dj, Workflow: publish.yml
#
- name: Publish DJ UI to npm
continue-on-error: true
working-directory: ./datajunction-ui
run: |
yarn install --frozen-lockfile
npm publish --access public --provenance
- name: Publish DJ Javascript client to npm
continue-on-error: true
working-directory: ./datajunction-clients/javascript
run: |
yarn install --frozen-lockfile
npm publish --access public --provenance
#
# Create GitHub Release
#
- name: Generate release notes
id: release_notes
run: |
CURRENT_VERSION="${{ steps.version.outputs.VERSION }}"
CURRENT_TAG="v${CURRENT_VERSION}"
echo "Current version: $CURRENT_VERSION"
echo "Current tag: $CURRENT_TAG"
# List all version tags (both v* and version-* formats)
echo "All tags:"
git tag -l 'v*' -l 'version-*'
# Find the previous version by:
# 1. List all tags matching v* or version-*
# 2. Extract just the version number
# 3. Sort by version
# 4. Filter out current version
# 5. Get the latest
PREV_VERSION=$(git tag -l 'v*' -l 'version-*' | \
sed -E 's/^(v|version-)//' | \
sort -V | \
grep -v "^${CURRENT_VERSION}$" | \
tail -1)
echo "Previous version: $PREV_VERSION"
# Find the actual tag name for the previous version (could be v* or version-*)
if git rev-parse "v${PREV_VERSION}" >/dev/null 2>&1; then
PREV_TAG="v${PREV_VERSION}"
elif git rev-parse "version-${PREV_VERSION}" >/dev/null 2>&1; then
PREV_TAG="version-${PREV_VERSION}"
else
PREV_TAG=""
fi
echo "Previous tag: $PREV_TAG"
# Generate changelog
if [ -n "$PREV_TAG" ]; then
echo "## What's Changed" > release_notes.md
echo "" >> release_notes.md
# Get commits between previous tag and HEAD
git log ${PREV_TAG}..HEAD --pretty=format:"* %s (%h)" --no-merges >> release_notes.md
echo "" >> release_notes.md
echo "" >> release_notes.md
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${CURRENT_TAG}" >> release_notes.md
else
echo "## Initial Release" > release_notes.md
echo "" >> release_notes.md
echo "First release of DataJunction!" >> release_notes.md
fi
echo "Release notes:"
cat release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
name: v${{ steps.version.outputs.VERSION }}
body_path: release_notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
echo "## Published v$VERSION" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### PyPI" >> $GITHUB_STEP_SUMMARY
echo "- [datajunction-server](https://pypi.org/project/datajunction-server/$VERSION/)" >> $GITHUB_STEP_SUMMARY
echo "- [datajunction](https://pypi.org/project/datajunction/$VERSION/)" >> $GITHUB_STEP_SUMMARY
echo "- [datajunction-query](https://pypi.org/project/datajunction-query/$VERSION/)" >> $GITHUB_STEP_SUMMARY
echo "- [datajunction-reflection](https://pypi.org/project/datajunction-reflection/$VERSION/)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### npm" >> $GITHUB_STEP_SUMMARY
echo "- [datajunction](https://www.npmjs.com/package/datajunction/v/$VERSION)" >> $GITHUB_STEP_SUMMARY
echo "- [datajunction-ui](https://www.npmjs.com/package/datajunction-ui/v/$VERSION)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### GitHub Release" >> $GITHUB_STEP_SUMMARY
echo "- [v$VERSION](https://github.com/${{ github.repository }}/releases/tag/v$VERSION)" >> $GITHUB_STEP_SUMMARY