Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release.yml #95

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
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
30 changes: 23 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
test:
uses: ./.github/workflows/ci.yml

# If tests are successful, we build the wheel and push it to the release
build-wheel:
needs: test
runs-on: ubuntu-latest
Expand All @@ -18,27 +17,44 @@ jobs:
with:
python-version: '3.13'

- name: Check package version matches tag
# Install dependencies for Poetry and the package
- name: Install dependencies
run: |
pkgver=$(python -c "import autocorpus; print(autocorpus.__version__, end='')")
Thomas-Rowlands marked this conversation as resolved.
Show resolved Hide resolved
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root # Install dependencies without installing the package
Thomas-Rowlands marked this conversation as resolved.
Show resolved Hide resolved

# NB: tag name must be prefixed by "v" (the default for GitHub Releases)
# Check package version matches release tag
- name: Check package version matches tag
run: |
poetry install
pkgver=$(python -c "
import autocorpus
try:
from importlib.metadata import version
print(version('autocorpus'), end='')
except importlib.metadata.PackageNotFoundError:
print(autocorpus.__dict__.get('__version__', '0.0.0'), end='')
")
echo "Detected package version: $pkgver"
# Ensure tag name matches version
test v$pkgver = ${{ github.ref_name }}


# Build package with Poetry
- name: Build package
run: poetry build

# Upload files as test artifact (to be retrieved later)
# Upload files as test artifact
- uses: actions/upload-artifact@v4
with:
path: dist/*

# Publish files as release artifacts
# Publish files as release artifacts
- uses: softprops/action-gh-release@v2
with:
files: dist/*

# If all goes well, publish to PyPI
publish-pypi:
needs: build-wheel
name: Publish to PyPI
Expand Down
Loading