Skip to content

Commit

Permalink
Setup workflow test to use trusted publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
brentvollebregt committed Nov 16, 2024
1 parent f37ff96 commit c4388b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 69 deletions.
74 changes: 5 additions & 69 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,14 @@
name: Publish On Tag

on:
workflow_call:
push:
tags:
- 'v*'

jobs:
initial-checks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Only allow tags on master to be published
run: |
tag_commit=$(git rev-parse ${{ github.ref }})
master_commit=$(git rev-parse origin/master)
if [ "$tag_commit" = "$master_commit" ]; then
echo "The tag and master are pointing to the same commit."
else
echo "The tag ($tag_commit) and master ($master_commit) are not pointing to the same commit."
exit 1
fi
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
# Exclude macos Python <3.11 due to https://github.com/actions/setup-python/issues/649#issuecomment-1745056485
exclude:
- os: macos-latest
python-version: 3.7
- os: macos-latest
python-version: 3.8
- os: macos-latest
python-version: 3.9
- os: macos-latest
python-version: 3.10

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Install package
run: pip install -e .

- name: Start Xvfb
if: matrix.os == 'ubuntu-latest'
run: |
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Run tests for Python ${{ matrix.python-version }} on ${{ matrix.os }}
run: pytest

publish:
needs: [initial-checks, test]
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -152,10 +89,9 @@ jobs:
run: python setup.py sdist bdist_wheel --universal

- name: Publish package
uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
repository-url: https://test.pypi.org/legacy/

- name: Create release
id: create_release
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
description="Converts .py to .exe using a simple graphical interface.",
long_description="".join(open("README.md", encoding="utf-8").readlines()),
long_description_content_type="text/markdown",
project_urls={
"Source Code": "https://github.com/brentvollebregt/auto-py-to-exe",
"Bug Tracker": "https://github.com/brentvollebregt/auto-py-to-exe/issues",
"Changelog": "https://github.com/brentvollebregt/auto-py-to-exe/blob/master/CHANGELOG.md",
},
keywords=["gui", "executable"],
packages=["auto_py_to_exe"],
include_package_data=True,
Expand Down

0 comments on commit c4388b5

Please sign in to comment.