remove unused instruction for provenance generation and changed how h… #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPi | |
on: | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: "read" | |
# Needed to access the workflow's OIDC identity. | |
id-token: "write" | |
jobs: | |
build: | |
name: "Build dists" | |
runs-on: "ubuntu-latest" | |
environment: | |
name: "publish" | |
outputs: | |
hashes: ${{ steps.hash.outputs.hashes }} | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install flake8 pytest pytest-flask build | |
- name: Lint, test, build | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
export PYTHONPATH=${PYTHONPATH}:. | |
pytest | |
python -m build | |
- name: Generate hashes | |
id: hash | |
run: | | |
#cd dist && echo "::set-output name=hashes::$(sha256sum * | base64 -w0)" >> "$GITHUB_OUTPUT" | |
cd dist | |
HASHES=$(sha256sum * | base64 -w0) | |
echo "hashes=$HASHES" >> "$GITHUB_OUTPUT" | |
- name: Upload dist | |
uses: actions/[email protected] | |
with: | |
name: "dist" | |
path: "dist/" | |
if-no-files-found: error | |
retention-days: 5 | |
provenance: | |
needs: [build] | |
permissions: | |
actions: read | |
contents: write | |
id-token: write | |
uses: "slsa-framework/slsa-github-generator/.github/workflows/[email protected]" | |
with: | |
base64-subjects: "${{ needs.build.outputs.hashes }}" | |
upload-assets: true | |
publish: | |
needs: ["build", "provenance"] | |
permissions: | |
contents: write | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Download artifacts | |
uses: actions/[email protected] | |
with: | |
name: "dist" | |
path: "dist/" | |
- name: Upload to releases | |
uses: softprops/[email protected] | |
with: | |
files: | | |
dist/* | |
- name: Publish to PyPi | |
uses: pypa/gh-action-pypi-publish@release/v1.9.0 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |