Update pre-commit to match #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build | |
on: | |
workflow_dispatch: | |
pull_request_target: | |
branches: [main] | |
types: [closed] | |
push: | |
permissions: | |
contents: read | |
env: | |
FORCE_COLOR: 1 | |
MYPY_FORCE_COLOR: 1 | |
PY_COLORS: 1 | |
TOX_TESTENV_PASSENV: >- | |
FORCE_COLOR | |
MYPY_FORCE_COLOR | |
NO_COLOR | |
PY_COLORS | |
PYTEST_THEME | |
PYTEST_THEME_MODE | |
TOX_PARALLEL_NO_SPINNER: 1 | |
jobs: | |
test: | |
name: Test | |
uses: ./.github/workflows/test.yml | |
build: | |
name: Build | |
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true || startsWith(github.ref, 'refs/tags/release/') | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
environment: build | |
permissions: | |
id-token: write | |
issues: write | |
pull-requests: write | |
steps: | |
- if: github.event.ref_type == 'tag' | |
uses: actions/checkout@v4 | |
- if: github.event.ref_type != 'tag' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
cache: pip | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[build] | |
- name: Build | |
run: python -m build | |
- name: Get Version | |
id: version | |
shell: bash | |
run: | | |
export VERSION=$(python -c "import sys;sys.path.append('src/modem_info');from _version import version;print(version)") | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
echo "version=$VERSION" | |
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]] || exit 1 | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
print-hash: true | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Render PR Template | |
id: pr-template | |
if: github.event_name == 'pull_request_target' | |
uses: chuhlomin/render-template@v1.10 | |
with: | |
template: ./.github/templates/pr-build.md | |
vars: | | |
version: ${{ steps.version.outputs.version }} | |
- name: Update PR with Build | |
if: github.event_name == 'pull_request_target' | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: ${{ steps.pr-template.outputs.result }} | |
reactions: rocket |