Skip to content

Commit

Permalink
Update the workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTG committed Apr 21, 2024
1 parent 05bf8db commit 5e3c001
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 65 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/build.yml

This file was deleted.

78 changes: 65 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,75 @@
name: release
name: Build & Release

on:
workflow_dispatch:
push:
tags:
- '*'
branches:
- main
- dev
pull_request:
branches:
- dev

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
environment:
name: release
url:
ttps://pypi.org/p/libretro.py
permissions:
id-token: write # Required for trusted publishing

steps:
- uses: actions/checkout@v3
- uses: extractions/setup-just@v1
- uses: actions/setup-python@v4
- 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:
python-version: '3.11'
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 install build
# Uncomment for your project
# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}
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 }}"

- name: Create Release
if: "${{ steps.changelog.outputs.version != steps.newest-tag.outputs.version }}"
uses: softprops/[email protected]
with:
token: ${{ secrets.RELEASE_TOKEN }}
tag_name: "v${{ steps.changelog.outputs.version }}"
body: "${{ steps.changelog.outputs.release-notes }}"

0 comments on commit 5e3c001

Please sign in to comment.