Skip to content

Commit 3295816

Browse files
committed
Rework CI script
1 parent f166c89 commit 3295816

File tree

1 file changed

+46
-38
lines changed

1 file changed

+46
-38
lines changed

.github/workflows/python-package.yml

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on: [ push, pull_request ]
88
jobs:
99
build-sdist:
1010
name: Build SDist
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212

1313
steps:
1414
- uses: actions/checkout@v4
@@ -42,15 +42,17 @@ jobs:
4242
- name: Upload SDist
4343
uses: actions/upload-artifact@v4
4444
with:
45+
name: wheel-sdist
4546
path: dist/*.tar.gz
47+
compression-level: 0 # already compressed
4648

4749
build-wheels:
4850
name: Build Wheels on ${{ matrix.os }}
4951
runs-on: ${{ matrix.os }}
5052
strategy:
5153
matrix:
5254
# macos-13 is an intel runner, macos-14 is apple silicon
53-
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
55+
os: [ ubuntu-22.04, windows-latest, macos-13, macos-14 ]
5456
linux_arch: [ 'x86_64' ] #[suffix, mac, windows, linux] arch names
5557

5658
steps:
@@ -71,7 +73,7 @@ jobs:
7173
- name: Install QEMU
7274
# install QEMU if building for linux
7375
uses: docker/setup-qemu-action@v2
74-
if: runner.os == 'linux'
76+
if: runner.os == 'linux'
7577
with:
7678
platforms: arm64
7779

@@ -83,57 +85,63 @@ jobs:
8385
- name: Upload Wheels
8486
uses: actions/upload-artifact@v4
8587
with:
88+
name: wheels-${{ matrix.os }}
8689
path: ./wheelhouse/*.whl
90+
compression-level: 0 # already compressed
8791

88-
publish:
89-
name: Publish to PyPI and Github
90-
needs: [ build-wheels, build-sdist ]
92+
publish-pypi:
93+
name: Deploy to PyPI
9194
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
92-
runs-on: ubuntu-latest
93-
95+
needs: [ build-wheels, build-sdist ]
96+
runs-on: ubuntu-22.04
97+
environment:
98+
name: Publish
99+
url: https://pypi.org/project/quicktex/${{ github.ref_name }}
100+
permissions:
101+
id-token: write
94102
steps:
95-
- uses: actions/checkout@v4 # just need the changelog
96-
97-
- name: Set up Python
98-
uses: actions/setup-python@v5.1.1
103+
- name: Download Artifacts
104+
uses: actions/download-artifact@v4
99105
with:
100-
python-version: '3.13'
106+
merge-multiple: true
107+
pattern: wheel*
108+
path: dist
101109

102-
- name: Install dependencies
103-
run: |
104-
python -m pip install --upgrade pip
105-
python -m pip install yaclog
110+
- name: Publish to PyPI
111+
uses: pypa/gh-action-pypi-publish@release/v1
106112

107-
- name: Get version name and body
108-
run: |
109-
echo "VERSION_TILE=Version $(yaclog show -n)" >> $GITHUB_ENV
110-
echo "$(yaclog show -mb)" >> RELEASE.md
113+
publish-github:
114+
name: Deploy to Github
115+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
116+
needs: [ build-wheels, build-sdist ]
117+
runs-on: ubuntu-22.04
118+
environment:
119+
name: Publish
120+
url: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
121+
permissions:
122+
contents: write
123+
steps:
124+
- uses: actions/checkout@v4
111125

112126
- name: Download Artifacts
113127
uses: actions/download-artifact@v4
114128
with:
115-
name: artifact
129+
merge-multiple: true
130+
pattern: wheel*
116131
path: dist
117132

118133
- name: List artifacts
119134
run: ls -l dist
120135

121-
- name: Publish to Test PyPI
122-
uses: pypa/gh-action-pypi-publish@release/v1
123-
with:
124-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
125-
repository_url: https://test.pypi.org/legacy/
126-
127-
- name: Publish to PyPI
128-
uses: pypa/gh-action-pypi-publish@release/v1
129-
with:
130-
password: ${{ secrets.PYPI_API_TOKEN }}
136+
- name: Get Changelog Information
137+
id: yaclog-show
138+
uses: drewcassidy/yaclog@1.5.0
131139

132140
- name: Publish to Github
133-
uses: softprops/action-gh-release@v1
134-
with:
135-
files: dist/*
136-
name: ${{ env.VERSION_TITLE }}
137-
body_path: RELEASE.md
141+
run: >
142+
gh release create ${{ github.ref_name }}
143+
--notes-file "${{ steps.yaclog-show.outputs.body-file }}"
144+
--title "${{ steps.yaclog-show.outputs.name }}"
145+
dist/*
138146
env:
139-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)