chore: Disable cache for release too 👷 #35
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: Python package | |
## Will run when commits pushed to master, or when PR opened for merging commits into master | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# cache: "poetry" | |
- name: Install poetry & Dependencies | |
run: pip install poetry && poetry install | |
- name: Run unit tests | |
run: poetry run python -m unittest discover -s tests | |
- name: Lint with flake8 | |
run: poetry run flake8 | |
release: | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
## full history of commits on repo will be checked out. Needed to for tool to determine how to set package version | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# cache: "poetry" | |
- name: Install dependencies | |
run: pip install poetry && poetry install | |
- name: Prepare package for release | |
env: | |
GH_TOKEN: ${{ secrets.github_token }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
semantic-release version | |
## Because inside the poetry venv? | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
# repository_url: https://test.pypi.org/legacy/ | |
- name: Upload to GH | |
env: | |
GH_TOKEN: ${{ secrets.github_token }} | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
semantic-release publish |