Skip to content

Commit 8f98bb5

Browse files
Github Actions - build deb (#1)
* build deb * add setups dependency * update deps * Update dep * update deps * Update deps * more deps * new release action * update action * update action * Bump version to 1.0.0 * update actions * Bump version to 1.0.1 * Bump version to 3.6.0-rc2 * update secret * Bump version to 3.6.0-rc2.post1 * update build deb * Bump version to 3.6.0-rc1.post11 * only run action once * Bump version to 3.6.0-rc2.post2 --------- Co-authored-by: GitHub Actions <[email protected]>
1 parent 26e0047 commit 8f98bb5

File tree

8 files changed

+114
-34
lines changed

8 files changed

+114
-34
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 3.6.0-rc1
2+
current_version = 3.6.0-rc2.post2
33
commit = False
44
tag = False
55
allow_dirty = False

.github/workflows/publish-to-pypi.yml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@ jobs:
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install setuptools
28-
pip install bump2version
29-
- name: Bumpversion
30-
run: bumpversion --new-version=${{ github.event.release.tag_name }} minor
31-
- name: Commit version change
32-
run: |
33-
git config --global user.name 'Github Actions'
34-
git config --global user.email '[email protected]'
35-
git commit -am "Release ${{ github.event.release.name }}" --allow-empty
36-
git tag -f ${{ github.event.release.tag_name }}
37-
git push origin HEAD:v3.6-dev
38-
git push origin -f --tags
3928
- name: Install pypa/build
4029
run: >-
4130
python3 -m
@@ -56,9 +45,6 @@ jobs:
5645
needs:
5746
- build
5847
runs-on: ubuntu-latest
59-
environment:
60-
name: pypi
61-
url: https://pypi.org/p/dsf-python
6248
permissions:
6349
id-token: write # IMPORTANT: mandatory for trusted publishing
6450
steps:
@@ -71,29 +57,35 @@ jobs:
7157
uses: pypa/gh-action-pypi-publish@release/v1
7258

7359
build-deb:
74-
name: Build Debian package for Raspberry Pi 📦
60+
name: Build Debian package 📦
7561
runs-on: ubuntu-latest
62+
# Add permissions for releases
63+
permissions:
64+
contents: write
7665
steps:
7766
- uses: actions/checkout@v4
78-
- name: Set up QEMU
79-
uses: docker/setup-qemu-action@v3
80-
- name: Build Debian package in Raspberry Pi OS container
81-
uses: docker/setup-buildx-action@v3
82-
- name: Build ARM Debian package
67+
- name: Set up Python
68+
uses: actions/setup-python@v2
69+
with:
70+
python-version: '3.x'
71+
- name: Install apt packages
72+
run: sudo apt-get update && sudo apt-get install -y dpkg-dev debhelper dh-python build-essential python3-all
73+
- name: Install dependencies
74+
run: |
75+
python -m pip install --upgrade pip
76+
pip install setuptools
77+
pip install stdeb3
78+
pip install wheel
79+
- name: Clean up previous builds
80+
run: rm -rf deb_dist/ || true
81+
- name: Build Debian package
8382
run: |
84-
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
85-
docker run --platform linux/arm/v7 -v $(pwd):/workspace -w /workspace \
86-
balenalib/raspberry-pi-debian:latest \
87-
/bin/bash -c "apt-get update && \
88-
apt-get install -y python3 python3-pip python3-dev python3-setuptools python3-stdeb dh-python \
89-
debhelper build-essential && \
90-
pip3 install -e . && \
91-
make build_deb"
83+
make build_deb || exit 1
9284
- name: List built packages
9385
run: find deb_dist -name "*.deb"
9486
- name: Upload Debian package to release
9587
uses: softprops/action-gh-release@v2
96-
if: github.event_name == 'release'
9788
with:
89+
token: ${{ secrets.PAT }}
9890
files: "deb_dist/*.deb"
9991
tag_name: ${{ github.event.release.tag_name }}

.github/workflows/python-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
branches: [ "*" ]
99
pull_request:
1010
branches: [ "*" ]
11+
release:
12+
types: [published]
1113

1214
jobs:
1315
build:

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Bump Version and Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
new_version:
7+
description: 'New version number (e.g., 1.2.3)'
8+
required: true
9+
10+
jobs:
11+
bump-and-release:
12+
runs-on: ubuntu-latest
13+
# Add write permissions for the GITHUB_TOKEN
14+
permissions:
15+
contents: write
16+
packages: write
17+
pull-requests: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
# Explicitly provide the token for private repo access
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.x'
29+
30+
- name: Install bumpversion
31+
run: pip install bump2version
32+
33+
- name: Bump version
34+
run: |
35+
bumpversion --new-version ${{ github.event.inputs.new_version }} --no-commit --no-tag minor
36+
37+
- name: Commit and tag version
38+
run: |
39+
git config --global user.name "GitHub Actions"
40+
git config --global user.email "[email protected]"
41+
git commit -am "Bump version to ${{ github.event.inputs.new_version }}" --allow-empty
42+
git tag ${{ github.event.inputs.new_version }}
43+
44+
- name: Push changes and tag
45+
run: |
46+
# Use authenticated URL format for pushing
47+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
48+
git push origin HEAD:gh-actions
49+
git push origin --tags
50+
51+
- name: Get previous tag
52+
id: prev_tag
53+
run: |
54+
git fetch --tags
55+
git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags > tags.txt
56+
readarray -t tags < tags.txt
57+
if [ ${#tags[@]} -lt 2 ]; then
58+
echo "prev_tag=" >> $GITHUB_OUTPUT
59+
else
60+
echo "prev_tag=${tags[1]}" >> $GITHUB_OUTPUT
61+
fi
62+
63+
- name: Generate changelog
64+
id: changelog
65+
run: |
66+
if [ -z "${{ steps.prev_tag.outputs.prev_tag }}" ]; then
67+
echo "body=Initial release" >> $GITHUB_OUTPUT
68+
else
69+
log=$(git log --pretty=format:"- %s (%h)" ${{ steps.prev_tag.outputs.prev_tag }}..${{ github.event.inputs.new_version }})
70+
echo "body<<EOF" >> $GITHUB_OUTPUT
71+
echo "## Changelog since ${{ steps.prev_tag.outputs.prev_tag }}" >> $GITHUB_OUTPUT
72+
echo "$log" >> $GITHUB_OUTPUT
73+
echo "EOF" >> $GITHUB_OUTPUT
74+
fi
75+
76+
- name: Create GitHub Release
77+
id: create_release
78+
uses: actions/[email protected]
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.PAT }}
81+
with:
82+
tag_name: ${{ github.event.inputs.new_version }}
83+
release_name: ${{ github.event.inputs.new_version }}
84+
body: ${{ steps.changelog.outputs.body }}
85+
draft: false
86+
prerelease: false

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ check_dist: update_dist
1818
build_deb:
1919
rm -rf deb_dist/
2020
sed -i -E '/forced-upstream-version/ s/([0-9]+)\.([0-9]+)\.([0-9]+)-([a-z]+)([0-9]+)/\1.\2.\3~\4\5/' setup.cfg
21-
python setup.py --command-packages=stdeb.command sdist_dsc bdist_deb
21+
python3 setup.py --command-packages=stdeb3.command bdist_deb
2222
sed -i -E '/forced-upstream-version/ s/([0-9]+)\.([0-9]+)\.([0-9]+)~([a-z]+)([0-9]+)/\1.\2.\3-\4\5/' setup.cfg
2323
dpkg-deb -I deb_dist/*.deb

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ max-line-length = 120
88

99
[sdist_dsc]
1010
# Force the version to use `~` before any prerelease identifiers
11-
forced-upstream-version = 3.6.0-rc1
11+
forced-upstream-version = 3.6.0-rc2.post2

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setuptools.setup(
88
name="dsf-python",
9-
version="3.6.0-rc1",
9+
version="3.6.0-rc2.post2",
1010
description="Python interface to access DuetSoftwareFramework",
1111
long_description=long_description,
1212
long_description_content_type="text/markdown",

src/dsf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.6.0-rc1"
1+
__version__ = "3.6.0-rc2.post2"
22

33
# path to unix socket file
44
SOCKET_FILE = "/run/dsf/dcs.sock"

0 commit comments

Comments
 (0)