Skip to content

Commit 1d9d2e0

Browse files
committed
fix: release workflow
1 parent 6795d2c commit 1d9d2e0

3 files changed

Lines changed: 24 additions & 18 deletions

File tree

.github/create-release.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Usage: merge all feature branches into dev first
3+
# run this script on dev branch
4+
# create a PR to merge dev into master (will create a new release)
5+
6+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
set -e
8+
9+
echo "Please note: If you did not use this script before, please run ./install-release-tools.sh!"
10+
11+
BUMP="${1:-path}"
12+
VERSION=$(cat "${DIR}/../VERSION")
13+
NEW_VERSION=$(semver bump $BUMP $VERSION)
14+
(cd "${DIR}/../src" && dch -v ${NEW_VERSION} --distribution main "$(git log -1 --pretty=%B)" --force-distribution)

.github/install-release-tools.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
sudo apt-get install -y devscripts
3+
git clone https://github.com/fsaintjacques/semver-tool /tmp/semver
4+
(cd /tmp/semver && sudo make install)

.github/workflows/build-app-release.yaml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ on:
22
push:
33
paths:
44
- 'src/**'
5-
- '!src/debian/changelog'
65
# branches: master
76

87
jobs:
@@ -60,24 +59,13 @@ jobs:
6059
run: |
6160
DESTDIR=${ROOT_FS} make install
6261
63-
# TODO: move the devscripts installation into docker container image build
64-
- name: Bump the package version
62+
- name: Read the package version
6563
working-directory: usbproxy
66-
id: bump-version
64+
id: version
6765
run: |
68-
VERSION=$(cat ./VERSION)
69-
NEW_VERSION=$(semver bump patch $VERSION)
70-
apt-get install -y devscripts
71-
cd ./src && dch -v ${NEW_VERSION} --distribution main "$(git log -1 --pretty=%B)" --force-distribution
66+
NEW_VERSION=$(cat ./VERSION)
7267
echo '::set-output name=NEW_VERSION::$NEW_VERSION'
7368
74-
# commit the changelog modification
75-
- uses: EndBug/add-and-commit@v7
76-
with:
77-
add: src/debian/changelog
78-
cwd: usbproxy
79-
message: "chore: modify changelog"
80-
8169
- name: Build the debian package
8270
working-directory: usbproxy/src
8371
run: |
@@ -95,7 +83,7 @@ jobs:
9583
uses: mathieudutour/github-tag-action@v5.1
9684
with:
9785
github_token: ${{ secrets.GITHUB_TOKEN }}
98-
custom_tag: "${{ steps.bump-version.outputs.NEW_VERSION }}"
86+
custom_tag: "${{ steps.version.outputs.NEW_VERSION }}"
9987

10088
- name: Create a GitHub release
10189
uses: actions/create-release@v1
@@ -114,8 +102,8 @@ jobs:
114102
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115103
with:
116104
upload_url: ${{ steps.create_release.outputs.upload_url }}
117-
asset_path: usbproxy/nesto-usbproxy_${{ steps.bump-version.outputs.NEW_VERSION }}_armhf.deb
118-
asset_name: nesto-usbproxy_${{ steps.bump-version.outputs.NEW_VERSION }}_armhf.deb
105+
asset_path: usbproxy/nesto-usbproxy_${{ steps.version.outputs.NEW_VERSION }}_armhf.deb
106+
asset_name: nesto-usbproxy_${{ steps.version.outputs.NEW_VERSION }}_armhf.deb
119107
asset_content_type: application/vnd.debian.binary-package
120108

121109
upload-package:

0 commit comments

Comments
 (0)