Skip to content

Merge pull request #20 from JSensebe/Second-batch-of-fixes #69

Merge pull request #20 from JSensebe/Second-batch-of-fixes

Merge pull request #20 from JSensebe/Second-batch-of-fixes #69

Workflow file for this run

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 }}"