OPS: Add missing permissions to publish workflow jobs #226
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions. On successful | |
# test, the package will be published to the test PyPi server. | |
name: python-ci | |
on: | |
push: | |
branches-ignore: | |
- main | |
jobs: | |
check-semantic-version: | |
if: "!contains(github.event.head_commit.message, 'skipci')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: octue/[email protected] | |
with: | |
path: setup.py | |
breaking_change_indicated_by: minor | |
run-tests: | |
if: "!contains(github.event.head_commit.message, 'skipci')" | |
runs-on: ubuntu-latest | |
env: | |
USING_COVERAGE: '3.8' | |
strategy: | |
matrix: | |
python: [3.8] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install tox | |
run: pip install tox | |
- name: Run tests | |
run: tox | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: coverage.xml | |
fail_ci_if_error: true | |
publish: | |
if: "!contains(github.event.head_commit.message, 'skipci')" | |
runs-on: ubuntu-latest | |
needs: [check-semantic-version, run-tests] | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Make package | |
run: | | |
python3 -m pip install --upgrade setuptools wheel | |
python3 setup.py sdist bdist_wheel | |
- name: Test package is publishable with PyPI test server | |
uses: pypa/[email protected] | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip_existing: true |