Skip to content

Commit

Permalink
Reuse GitHub Actions testing workflow and adjust nesting in publish w…
Browse files Browse the repository at this point in the history
…orkflow.
  • Loading branch information
lapets committed Jun 23, 2024
1 parent a09c9c7 commit bf79e2e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 56 deletions.
109 changes: 55 additions & 54 deletions .github/workflows/build-publish-sign-release.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,81 @@
name: build-publish-sign-release
on:
workflow_run:
workflows: ["lint-test-cover-docs"]
branches: [main]
types:
- completed
push:
tags:
- '*'
jobs:
call-workflow-lint-test-cover-docs:
name: Lint, test (measuring coverage), and generate documentation.
uses: ./.github/workflows/lint-test-cover-docs.yml
secrets: inherit
build:
name: Build package.
if: ${{ github.event.workflow_run.conclusion == 'success' }}
needs:
- call-workflow-lint-test-cover-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python.
uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: x64
- name: Install pypa/build.
run: python -m pip install .[publish]
- name: Build a source tarball and a binary wheel.
run: python -m build --sdist --wheel .
- name: Store the package distributions.
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

- uses: actions/checkout@v4
- name: Install Python.
uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: x64
- name: Install pypa/build.
run: python -m pip install .[publish]
- name: Build a source tarball and a binary wheel.
run: python -m build --sdist --wheel .
- name: Store the package distributions.
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish:
name: Publish package to PyPI.
if: startsWith(github.ref, 'refs/tags/') # Publish on tag pushes.
needs:
- build
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/blooms
permissions:
id-token: write
steps:
- name: Download all the package distributions.
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package to PyPI.
uses: pypa/gh-action-pypi-publish@release/v1

- name: Download all the package distributions.
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package to PyPI.
uses: pypa/gh-action-pypi-publish@release/v1
sign-release:
name: Sign package distributions with Sigstore and upload them to a GitHub release.
needs:
- publish
- publish
runs-on: ubuntu-latest
permissions:
contents: write # For GitHub.
id-token: write # For Sigstore.
steps:
- name: Download all the package distributions.
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the package distributions with Sigstore.
uses: sigstore/gh-action-sigstore-python@v2.1.1
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create a GitHub release.
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}'
- name: Upload package distributions and signatures/certificates to the GitHub release.
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
- name: Download all the package distributions.
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the package distributions with Sigstore.
uses: sigstore/gh-action-sigstore-python@v2.1.1
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create a GitHub release.
env:
GITHUB_TOKEN: ${{ github.token }}
run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}'
- name: Upload package distributions and signatures/certificates to the GitHub release.
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
5 changes: 4 additions & 1 deletion .github/workflows/lint-test-cover-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: lint-test-cover-docs
on:
push
push:
branches:
- '**'
workflow_call: # If invoked by build-publish-sign-release workflow.
jobs:
lint_test_cover_docs:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "blooms"
version = "2.0.0a1"
version = "2.0.0a2"
description = "Lightweight Bloom filter data structure derived from the built-in bytearray type."
license = {text = "MIT"}
authors = [
Expand Down

0 comments on commit bf79e2e

Please sign in to comment.