Skip to content

Commit adff0fb

Browse files
authored
Switch to reusable workflows (#82)
* switch to reusable workflows * Pass inherit secrets to publish job
1 parent d437edb commit adff0fb

File tree

3 files changed

+8
-67
lines changed

3 files changed

+8
-67
lines changed

.github/workflows/python-publish.yml

+2-33
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,7 @@ on:
1414
types: [published]
1515
workflow_dispatch:
1616

17-
permissions:
18-
contents: read
19-
2017
jobs:
2118
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/*
40-
- name: Publish package (to TestPyPI)
41-
if: github.event_name == 'workflow_dispatch' && github.repository == 'cpp-linter/clang-tools-pip'
42-
env:
43-
TWINE_USERNAME: __token__
44-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
45-
run: twine upload --repository testpypi dist/*
46-
- name: Publish package (to PyPI)
47-
if: github.event_name != 'workflow_dispatch' && github.repository == 'cpp-linter/clang-tools-pip'
48-
env:
49-
TWINE_USERNAME: __token__
50-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
51-
run: twine upload dist/*
19+
uses: cpp-linter/.github/.github/workflows/py-publish.yml@main
20+
secrets: inherit

.github/workflows/python-test.yml

+4-27
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
run: |
3232
python3 -m pip install --upgrade pip
3333
python3 -m pip install . -r requirements-dev.txt
34+
3435
- name: Run pre-commit
3536
run: pre-commit run --all-files
3637

@@ -133,30 +134,6 @@ jobs:
133134
fi
134135
135136
docs:
136-
runs-on: ubuntu-latest
137-
steps:
138-
- uses: actions/checkout@v4
139-
140-
- uses: actions/setup-python@v5
141-
with:
142-
python-version: "3.10"
143-
144-
- run: python -m pip install . -r docs/requirements.txt
145-
146-
- name: Build docs
147-
working-directory: docs
148-
run: sphinx-build -E -W -b html . _build/html
149-
150-
- name: Save built docs as artifact
151-
uses: actions/upload-artifact@v4
152-
with:
153-
name: "clang-tools-pip_docs"
154-
path: docs/_build/html
155-
156-
- name: Upload to github pages
157-
# only publish doc changes from main branch
158-
if: github.ref == 'refs/heads/main'
159-
uses: peaceiris/actions-gh-pages@v3
160-
with:
161-
github_token: ${{ secrets.GITHUB_TOKEN }}
162-
publish_dir: ./docs/_build/html
137+
uses: cpp-linter/.github/.github/workflows/sphinx.yml@main
138+
with:
139+
path-to-doc: docs/_build/html

.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

0 commit comments

Comments
 (0)