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
58 changes: 57 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,72 @@ jobs:
changelog changelog.md \
--snippets=.snippets \
--in-place
- name: Build package
- name: Extract latest version from changelog
run: |
changelog2version \
--changelog_file changelog.md \
--print \
--debug \
--pretty \
--output changelog.json
- name: Update package.json file
run: |
upy-package \
--setup_file setup.py \
--package_changelog_file changelog.md \
--package_file package.json \
--pretty \
--create
- name: Update version.py file
run: |
changelog2version \
--changelog_file changelog.md \
--version_file be_upy_blink/version.py \
--version_file_type py \
--debug
- name: Build package
run: |
python setup.py sdist
rm dist/*.orig
# sdist call create non conform twine files *.orig, remove them
- name: Test built package
run: |
twine check dist/*.tar.gz
- name: Create release branch
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
LATEST_CHANGELOG_VERSION=$(jq -r '.info.version' changelog.json)
echo "LATEST_CHANGELOG_VERSION: ${LATEST_CHANGELOG_VERSION}"
echo "changelog.json file:"
cat changelog.json
DESIRED_BRANCH="release/${LATEST_CHANGELOG_VERSION}"
echo "DESIRED_BRANCH: ${DESIRED_BRANCH}"
git ls-remote \
--exit-code \
--heads \
origin ${DESIRED_BRANCH} >/dev/null 2>&1
EXIT_CODE=$?
echo "EXIT_CODE: ${EXIT_CODE}"
if [[ ${EXIT_CODE} == '0' ]]; then
echo "Git branch '${DESIRED_BRANCH}' exists on remote"
git checkout release/${LATEST_CHANGELOG_VERSION}
elif [[ ${EXIT_CODE} == '2' ]]; then
echo "Git branch '${DESIRED_BRANCH}' does not exist on remote"
git checkout -b release/${LATEST_CHANGELOG_VERSION}
fi
git diff > diff.log
echo "Diff in repo"
cat diff.log
if [[ $(git status --porcelain --untracked-files=no | wc -l) -gt 0 ]]; then
echo "changed files available"
git add package.json changelog.md be_upy_blink/version.py
git status
git commit -m "chore: files for release ${LATEST_CHANGELOG_VERSION}"
git push -u origin release/${LATEST_CHANGELOG_VERSION}
else
echo "nothing new to commit and push"
fi
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1.13
with:
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,37 @@ jobs:
changelog changelog.md \
--snippets=.snippets \
--in-place
- name: Build package
- name: Extract latest version from changelog
run: |
changelog2version \
--changelog_file changelog.md \
--print \
--debug \
--pretty \
--output changelog.json
- name: Update package.json file
run: |
upy-package \
--setup_file setup.py \
--package_changelog_file changelog.md \
--package_file package.json \
--pretty \
--create
- name: Update version.py file
run: |
changelog2version \
--changelog_file changelog.md \
--version_file be_upy_blink/version.py \
--version_file_type py \
--additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \
--debug
- name: Build package
run: |
python setup.py sdist
- name: Test built package
rm dist/*.orig
# sdist call creates non twine conform "*.orig" files, remove them
- name: Test built package
run: |
rm dist/*.orig
twine check dist/*.tar.gz
- name: Archive build package artifact
uses: actions/upload-artifact@v7
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# snippets2changelog specific
changelog.md
changelog.md.new
changelog.json
latest-entry.json
latest_description.txt

# custom, package specific ignores
.DS_Store
Expand Down
13 changes: 13 additions & 0 deletions .snippets/28.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Create release branch after merge
<!--
type: feature
scope: all
affected: all
-->

This change creates a new release branch `release/<VERSION>` after a merge and adds the following files to it:
- `changelog.md`
- `package.json`
- `<PACKAGE>/version.py`

This closes [#28](https://github.com/brainelectronics/micropython-package-template/issues/28)
2 changes: 1 addition & 1 deletion be_upy_blink/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

__version_info__ = ("0", "12", "0")
__version_info__ = ("0", "13", "0")
__version__ = '.'.join(__version_info__)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
]
],
"deps": [],
"version": "0.12.0"
"version": "0.13.0"
}
4 changes: 4 additions & 0 deletions requirements-deploy-lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cffi==2.0.0
changelog2version==0.12.1
charset-normalizer==3.4.7
cryptography==46.0.6
deepdiff==6.7.1
docutils==0.22.4
gitdb==4.0.12
GitPython==3.1.46
Expand All @@ -19,8 +20,10 @@ keyring==25.7.0
markdown-it-py==4.0.0
MarkupSafe==3.0.3
mdurl==0.1.2
mock==4.0.3
more-itertools==11.0.1
nh3==0.3.4
ordered-set==4.1.0
packaging==26.0
pycparser==3.0
Pygments==2.20.0
Expand All @@ -32,6 +35,7 @@ rfc3986==2.0.0
rich==14.3.3
SecretStorage==3.5.0
semver==2.13.0
setup2upypackage==0.5.0
smmap==5.0.3
snippets2changelog==1.7.0
twine==6.2.0
Expand Down
1 change: 1 addition & 0 deletions requirements-deploy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
twine>=6.2.0,<7
changelog2version>=0.12.1,<1
snippets2changelog>=1.6.0,<2
setup2upypackage>=0.5.0,<1
Loading