Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .github/workflows/publish.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,66 @@ permissions:
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v4
with:
config-file: .github/release-please-config.json
manifest-file: .release-please-manifest.json

# Checkout code only if a release was created
- name: Checkout code
if: ${{ steps.release.outputs.release_created }}
uses: actions/checkout@v4

# Set up Python only if a release was created
- name: Set up Python
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-python@v5
with:
python-version: "3.12"

# Build the package only if a release was created
- name: Build wheel/sdist
if: ${{ steps.release.outputs.release_created }}
run: |
python -m pip install --upgrade pip build
python -m build

# Publish to PyPI only if a release was created
- name: Publish to PyPI
if: ${{ steps.release.outputs.release_created }}
uses: pypa/gh-action-pypi-publish@v1.10.3
with:
password: ${{ secrets.PYPI_API_TOKEN }}

# Optional: Add a comment to the release with PyPI link
- name: Add PyPI link to release
if: ${{ steps.release.outputs.release_created }}
uses: actions/github-script@v7
with:
script: |
const tagName = '${{ steps.release.outputs.tag_name }}';
const version = tagName.replace(/^v/, '');
const pypiUrl = `https://pypi.org/project/insdc-benchmarking-scripts/${version}/`;

// Get the release by tag
const { data: release } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tagName
});

// Update release body with PyPI link
const updatedBody = `${release.body}\n\n---\n\n📦 **PyPI Package:** ${pypiUrl}`;

await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
body: updatedBody
});