Add a required import #53
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: Build & Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- dev | |
jobs: | |
release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
url: https://pypi.org/p/libretro.py | |
permissions: | |
id-token: write # Required for trusted publishing | |
steps: | |
- name: Check Out Source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # To ensure we have all tags | |
- name: Install Just | |
uses: extractions/setup-just@v2 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
cache-dependency-path: setup.py | |
- name: Install Virtual Environment | |
run: just install | |
- name: Validate Formatting | |
run: just black-check isort-check | |
- name: Validate Security | |
run: just bandit | |
- name: Get Latest Changelog Version | |
id: changelog | |
uses: release-flow/[email protected] | |
with: | |
command: query | |
version: latest | |
- name: Get the Newest Tag | |
id: newest-tag | |
run: | | |
echo "version=`git tag --list "v[0-9]*.[0-9]*.[0-9]*" --sort=-v:refname | head -n1 | cut -c2-`" >> "$GITHUB_OUTPUT" | |
- name: Build package | |
run: just build | |
# Uses the "build" recipe from the justfile | |
- name: Publish to PyPI | |
uses: pypa/[email protected] | |
if: "${{ steps.changelog.outputs.version != steps.newest-tag.outputs.version && github.event_name == 'push' && github.ref == 'refs/heads/main' }}" | |
- name: Create Release | |
if: "${{ steps.changelog.outputs.version != steps.newest-tag.outputs.version && github.event_name == 'push' && github.ref == 'refs/heads/main'}}" | |
uses: softprops/[email protected] | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} | |
tag_name: "v${{ steps.changelog.outputs.version }}" | |
body: "${{ steps.changelog.outputs.release-notes }}" |