Skip to content

Commit 7b7e669

Browse files
authored
Update publish.yml
1 parent 4c95201 commit 7b7e669

File tree

1 file changed

+14
-53
lines changed

1 file changed

+14
-53
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,37 @@
1-
name: Build and Publish to PyPI
1+
name: Publish to PyPI
22

33
on:
44
push:
5-
branches: [ main, master ]
65
tags:
76
- 'v*'
8-
pull_request:
9-
branches: [ main, master ]
7+
workflow_dispatch: # Allow manual triggering
108

119
jobs:
12-
test:
10+
publish:
11+
name: Build and Publish to PyPI
1312
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
1713

18-
steps:
19-
- uses: actions/checkout@v3
20-
21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v4
23-
with:
24-
python-version: ${{ matrix.python-version }}
25-
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install build wheel
30-
pip install -e .
31-
32-
- name: Test installation
33-
run: |
34-
gtfo --version
35-
gtfo bash || true # Allow failure for demo
36-
37-
build-and-publish:
38-
needs: test
39-
runs-on: ubuntu-latest
40-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
14+
permissions:
15+
id-token: write # Required for trusted publishing
4116

4217
steps:
43-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
4419

4520
- name: Set up Python
46-
uses: actions/setup-python@v4
21+
uses: actions/setup-python@v5
4722
with:
48-
python-version: '3.10'
23+
python-version: '3.11'
4924

50-
- name: Install build dependencies
25+
- name: Install build tools
5126
run: |
5227
python -m pip install --upgrade pip
53-
pip install build wheel twine
28+
pip install build
5429
5530
- name: Build package
5631
run: python -m build
5732

58-
- name: Check package
59-
run: twine check dist/*
60-
61-
- name: Publish to Test PyPI
62-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
63-
env:
64-
TWINE_USERNAME: __token__
65-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
66-
run: |
67-
twine upload --repository testpypi dist/* --skip-existing || true
68-
continue-on-error: true
33+
- name: Check distribution
34+
run: ls -lah dist/
6935

7036
- name: Publish to PyPI
71-
if: startsWith(github.ref, 'refs/tags/')
72-
env:
73-
TWINE_USERNAME: __token__
74-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
75-
run: |
76-
twine upload dist/*
37+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)