Skip to content

Commit c6751dd

Browse files
authored
Switch to reusable workflows (#31)
* swith to reusable workflows * Update test.yml * Update test.yml * Update test.yml * Update test.yml * Update test.yml * Update test.yml
1 parent 9b47c42 commit c6751dd

File tree

3 files changed

+7
-51
lines changed

3 files changed

+7
-51
lines changed

.github/workflows/publish.yml

+1-41
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
91
name: Upload Python Package
102

113
on:
@@ -14,38 +6,6 @@ on:
146
types: [published]
157
workflow_dispatch:
168

17-
permissions:
18-
contents: read
19-
209
jobs:
2110
deploy:
22-
23-
runs-on: ubuntu-latest
24-
25-
steps:
26-
- uses: actions/checkout@v4
27-
# use fetch --all for setuptools_scm to work
28-
with:
29-
fetch-depth: 0
30-
- name: Set up Python
31-
uses: actions/setup-python@v5
32-
with:
33-
python-version: '3.x'
34-
- name: Install dependencies
35-
run: python -m pip install --upgrade pip twine
36-
- name: Build wheel
37-
run: python -m pip wheel -w dist .
38-
- name: Check distribution
39-
run: twine check dist/cpp_linter_hooks*
40-
- name: Publish package (to TestPyPI)
41-
if: github.event_name == 'workflow_dispatch' && github.repository == 'cpp-linter/cpp-linter-hooks'
42-
env:
43-
TWINE_USERNAME: __token__
44-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
45-
run: twine upload --repository testpypi dist/cpp_linter_hooks*
46-
- name: Publish package (to PyPI)
47-
if: github.event_name != 'workflow_dispatch' && github.repository == 'cpp-linter/cpp-linter-hooks'
48-
env:
49-
TWINE_USERNAME: __token__
50-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
51-
run: twine upload dist/cpp_linter_hooks*
11+
uses: cpp-linter/.github/.github/workflows/py-publish.yml@main

.github/workflows/release-drafter.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,5 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
update_release_draft:
11-
runs-on: ubuntu-latest
12-
steps:
13-
# Draft your next Release notes as Pull Requests are merged into the default branch
14-
- uses: release-drafter/release-drafter@v6
15-
env:
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
draft-release:
11+
uses: cpp-linter/.github/.github/workflows/release-drafter.yml@main

.github/workflows/test.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
pre-commit:
12+
uses: cpp-linter/.github/.github/workflows/pre-commit.yml@main
13+
with:
14+
commands: pip install pytest
1115
test:
1216
runs-on: ubuntu-latest
1317
steps:
@@ -23,9 +27,6 @@ jobs:
2327
pip install .
2428
pip install -r requirements-dev.txt
2529
26-
- name: Run pre-commit against all files
27-
run: pre-commit run --all-files
28-
2930
- name: Run tests and collect coverage
3031
run: |
3132
coverage run --source=tests,cpp_linter_hooks -m pytest -vv

0 commit comments

Comments
 (0)