Skip to content

Commit fecbc2f

Browse files
Create release branch after merge
1 parent 93afb50 commit fecbc2f

File tree

5 files changed

+78
-4
lines changed

5 files changed

+78
-4
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,53 @@ jobs:
3535
changelog changelog.md \
3636
--snippets=.snippets \
3737
--in-place
38-
- name: Build package
38+
- name: Extract latest version from changelog
39+
run: |
40+
changelog2version \
41+
--changelog_file changelog.md \
42+
--print \
43+
--debug \
44+
--pretty \
45+
--output changelog.json
46+
- name: Update package.json file
47+
run: |
48+
upy-package \
49+
--setup_file setup.py \
50+
--package_changelog_file changelog.md \
51+
--package_file package.json \
52+
--pretty \
53+
--create
54+
- name: Update package version file
3955
run: |
4056
changelog2version \
4157
--changelog_file changelog.md \
4258
--version_file be_upy_blink/version.py \
4359
--version_file_type py \
4460
--debug
61+
- name: Build package
62+
run: |
4563
python setup.py sdist
4664
rm dist/*.orig
4765
# sdist call create non conform twine files *.orig, remove them
66+
- name: Test built package
67+
run: |
68+
twine check dist/*.tar.gz
69+
- name: Create release branch
70+
run: |
71+
LATEST_CHANGELOG_VERSION=$(jq -r '.info.version' changelog.json)
72+
echo "LATEST_CHANGELOG_VERSION: ${LATEST_CHANGELOG_VERSION}"
73+
echo "changelog.json file:"
74+
cat changelog.json
75+
git config user.name "github-actions"
76+
git config user.email "github-actions@github.com"
77+
git diff > diff.log
78+
echo "Diff in repo"
79+
cat diff.log
80+
git checkout -b release/${LATEST_CHANGELOG_VERSION}
81+
git add package.json changelog.md be_upy_blink/version.py
82+
git status
83+
git commit -m "chore: add version files for release ${LATEST_CHANGELOG_VERSION}"
84+
git push -u origin release/${LATEST_CHANGELOG_VERSION}
4885
- name: Publish package
4986
uses: pypa/gh-action-pypi-publish@release/v1.13
5087
with:

.github/workflows/test-release.yaml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,37 @@ jobs:
3232
changelog changelog.md \
3333
--snippets=.snippets \
3434
--in-place
35-
- name: Build package
35+
- name: Extract latest version from changelog
36+
run: |
37+
changelog2version \
38+
--changelog_file changelog.md \
39+
--print \
40+
--debug \
41+
--pretty \
42+
--output changelog.json
43+
- name: Update package.json file
44+
run: |
45+
upy-package \
46+
--setup_file setup.py \
47+
--package_changelog_file changelog.md \
48+
--package_file package.json \
49+
--pretty \
50+
--create
51+
- name: Update package version file
3652
run: |
3753
changelog2version \
3854
--changelog_file changelog.md \
3955
--version_file be_upy_blink/version.py \
4056
--version_file_type py \
4157
--additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \
4258
--debug
59+
- name: Build package
60+
run: |
4361
python setup.py sdist
44-
- name: Test built package
62+
rm dist/*.orig
4563
# sdist call creates non twine conform "*.orig" files, remove them
64+
- name: Test built package
4665
run: |
47-
rm dist/*.orig
4866
twine check dist/*.tar.gz
4967
- name: Archive build package artifact
5068
uses: actions/upload-artifact@v7
@@ -55,6 +73,17 @@ jobs:
5573
name: dist_repo.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }}
5674
path: dist/*.tar.gz
5775
retention-days: 14
76+
- name: Check branch existance
77+
run: |
78+
LATEST_CHANGELOG_VERSION=$(jq -r '.info.version' changelog.json)
79+
DESIRED_BRANCH="release/${LATEST_CHANGELOG_VERSION}"
80+
git ls-remote --exit-code --heads origin ${BRANCH} >/dev/null 2>&1
81+
EXIT_CODE=$?
82+
if [[ ${EXIT_CODE} == '0' ]]; then
83+
echo "Git branch '${BRANCH}' exists in the remote repository"
84+
elif [[ ${EXIT_CODE} == '2' ]]; then
85+
echo "Git branch '${BRANCH}' does not exist in the remote repository"
86+
fi
5887
- name: Publish package
5988
uses: pypa/gh-action-pypi-publish@release/v1.13
6089
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# snippets2changelog specific
22
changelog.md
33
changelog.md.new
4+
changelog.json
5+
latest-entry.json
6+
latest_description.txt
47

58
# custom, package specific ignores
69
.DS_Store

requirements-deploy-lock.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ cffi==2.0.0
44
changelog2version==0.12.1
55
charset-normalizer==3.4.7
66
cryptography==46.0.6
7+
deepdiff==6.7.1
78
docutils==0.22.4
89
gitdb==4.0.12
910
GitPython==3.1.46
@@ -19,8 +20,10 @@ keyring==25.7.0
1920
markdown-it-py==4.0.0
2021
MarkupSafe==3.0.3
2122
mdurl==0.1.2
23+
mock==4.0.3
2224
more-itertools==11.0.1
2325
nh3==0.3.4
26+
ordered-set==4.1.0
2427
packaging==26.0
2528
pycparser==3.0
2629
Pygments==2.20.0
@@ -32,6 +35,7 @@ rfc3986==2.0.0
3235
rich==14.3.3
3336
SecretStorage==3.5.0
3437
semver==2.13.0
38+
setup2upypackage==0.5.0
3539
smmap==5.0.3
3640
snippets2changelog==1.7.0
3741
twine==6.2.0

requirements-deploy.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
twine>=6.2.0,<7
55
changelog2version>=0.12.1,<1
66
snippets2changelog>=1.6.0,<2
7+
setup2upypackage>=0.5.0,<1

0 commit comments

Comments
 (0)