Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install build dependencies
Expand All @@ -35,15 +35,18 @@ jobs:
--version_file_type py \
--debug
python -m build .
- name: Test built package
run: |
twine check dist/*
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1.5
uses: pypa/gh-action-pypi-publish@release/v1.13
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
verbose: true
print_hash: true
- name: 'Create changelog based release'
uses: brainelectronics/changelog-based-release@v1
uses: brainelectronics/changelog-based-release@v1.1.0
with:
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
Expand Down
63 changes: 52 additions & 11 deletions .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,95 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Count run number
id: count
uses: actions/github-script@v9
with:
script: |
const pr = context.payload.pull_request;
if (!pr) {
core.setFailed("This workflow must be triggered by a pull request.");
return;
}

const pr_number = pr.number;
const workflow_name = context.workflow;
const branch_name = pr.head.ref;
const event_match = "pull_request";
console.log("PR Number: " + pr_number);
console.log("Workflow name: " + workflow_name);
console.log("Branch name: " + branch_name);

if (!pr_number) {
console.log("No pull request number found in context.");
core.setOutput("count", 0);
return;
}

const runs = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
event: event_match,
branch: branch_name,
per_page: 100
});

const filtered = runs.data.workflow_runs.filter(run =>
run.name === workflow_name &&
run.event === event_match &&
run.pull_requests?.some(p => p.number === pr_number)
);
console.log("Matches for filters aka runs: " + filtered.length);

const count = filtered.length > 0 ? filtered.length : 1;
core.setOutput("rc_number", count);
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install build dependencies
run: |
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
- name: Build package
run: |
changelog2version \
--changelog_file changelog.md \
--version_file src/setup2upypackage/version.py \
--version_file_type py \
--additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \
--additional_version_info="-rc${{ steps.count.outputs.rc_number }}.dev${{ github.event.number }}" \
--debug
python -m build .
- name: Test built package
run: |
twine check dist/*.tar.gz
twine check dist/*
- name: Archive build package artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v7
with:
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
# ${{ github.repository }} and ${{ github.ref_name }} can't be used
# for artifact name due to unallowed '/'
name: dist_repo.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }}
name: dist_repo.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ steps.count.outputs.rc_number }}
path: dist/*.tar.gz
retention-days: 14
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1.5
uses: pypa/gh-action-pypi-publish@release/v1.13
with:
repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
skip_existing: true
verbose: true
print_hash: true
- name: 'Create changelog based prerelease'
uses: brainelectronics/changelog-based-release@v1
uses: brainelectronics/changelog-based-release@v1.1.0
with:
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
# or you set the "contents" permissions to "write" as in this example
changelog-path: changelog.md
tag-name-prefix: ''
tag-name-extension: '-rc${{ github.run_number }}.dev${{ github.event.number }}'
tag-name-extension: '-rc${{ steps.count.outputs.rc_number }}.dev${{ github.event.number }}'
release-name-prefix: ''
release-name-extension: '-rc${{ github.run_number }}.dev${{ github.event.number }}'
release-name-extension: '-rc${{ steps.count.outputs.rc_number }}.dev${{ github.event.number }}'
draft-release: true
prerelease: true
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install test dependencies
Expand All @@ -46,7 +46,6 @@ jobs:
python -m tox -e py
- name: Install deploy dependencies
run: |
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
pip install .
- name: Build package
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
test-and-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Execute tests
Expand All @@ -27,7 +27,7 @@ jobs:
run: |
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./reports/coverage/coverage.xml
Expand Down
10 changes: 9 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
-->

## Released
## [0.5.1] - 2026-04-27
### Fixed
- This change creates the correct release candidate number based on the action run of a pull request workflow run `test-release` instead of the total number of this workflow run. By this fix, the `-rcX` metadata starts at `1` and is incremented with every push, no matter if the push is a force push or a classic new commit on top in a ongoing pull request.
- Update external action versions to latest available version
- Fix license specification in `setup.py` file
- Check all files in `dist/`, not only `*.tar.gz`

## [0.5.0] - 2023-07-05
### Added
- pre-commit hook and config files
Expand Down Expand Up @@ -53,8 +60,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$"
- Not used files provided with [template repo](https://github.com/brainelectronics/micropython-i2c-lcd)

<!-- Links -->
[Unreleased]: https://github.com/brainelectronics/micropython-package-validation/compare/0.5.0...main
[Unreleased]: https://github.com/brainelectronics/micropython-package-validation/compare/0.5.1...main

[0.5.1]: https://github.com/brainelectronics/micropython-package-validation/tree/0.5.1
[0.5.0]: https://github.com/brainelectronics/micropython-package-validation/tree/0.5.0
[0.4.0]: https://github.com/brainelectronics/micropython-package-validation/tree/0.4.0
[0.3.0]: https://github.com/brainelectronics/micropython-package-validation/tree/0.3.0
Expand Down
5 changes: 3 additions & 2 deletions requirements-deploy.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# List external packages here
# Avoid fixed versions
# # to upload package to PyPi or other package hosts
twine>=4.0.1,<5
changelog2version>=0.5.0,<1
build>=1.4.4,<2
twine>=6.2.0,<7
changelog2version>=0.12.1,<1
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
# Pick your license as you wish
"License :: OSI Approved :: MIT License",
# "License :: OSI Approved :: MIT License",
# Specify the Python versions you support here. In particular, ensure
# that you indicate you support Python 3. These classifiers are *not*
# checked by 'pip install'. See instead 'python_requires' below.
Expand All @@ -101,6 +101,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
],
license="MIT",
# This field adds keywords for your project which will appear on the
# project page. What does your project relate to?
#
Expand Down
Loading