From ae2bc2140482954e2690c9753304df405485c7d9 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Sun, 17 Sep 2023 12:06:45 +0200 Subject: [PATCH 1/5] fix: fix wrong messages (#183) Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --- libs/init_stream.sh | 4 ++-- libs/messages.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/init_stream.sh b/libs/init_stream.sh index 40edd19e..4b6dce64 100755 --- a/libs/init_stream.sh +++ b/libs/init_stream.sh @@ -30,8 +30,8 @@ function construct_streamer { if [[ "$(is_raspberry_pi)" = "1" ]] && [[ "$(is_ubuntu_arm)" = "0" ]]; then MULTI_INSTANCES+=( "${cams}" ) else - log_msg "WARN: Mode 'multi' is not supported on your device!" - log_msg "WARN: Falling back to Mode 'mjpg'" + log_msg "WARN: Mode 'camera-streamer' is not supported on your device!" + log_msg "WARN: Falling back to Mode 'ustreamer'" MJPG_INSTANCES+=( "${cams}" ) fi ;; diff --git a/libs/messages.sh b/libs/messages.sh index 90eedb0c..0e9607b5 100755 --- a/libs/messages.sh +++ b/libs/messages.sh @@ -39,13 +39,13 @@ function help_msg { function deprecated_msg_1 { log_msg "Parameter 'streamer' is deprecated!" - log_msg "Please use mode: [ mjpg | multi ]" + log_msg "Please use mode: [ ustreamer | camera-streamer ]" log_msg "ERROR: Please update your crowsnest.conf! Stopped." } function unknown_mode_msg { log_msg "WARN: Unknown Mode configured!" - log_msg "WARN: Using 'mode: mjpg' as fallback!" + log_msg "WARN: Using 'mode: ustreamer' as fallback!" } ## v4l2_control lib From b85de7b0ab076bdeacd12f4d72db38d89aae550e Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Tue, 31 Oct 2023 12:06:51 +0100 Subject: [PATCH 2/5] chore: add release workflow (#194) * chore: add release workflow Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * chore: fix GITHUB_TOKEN permissions * chore: fix broken commit links * chore: add post- and preprocessing for release workflow * chore: update cliff action version * chore: fix syntax error * chore: fix PR url * chore: bump to actions/checkout v4 --------- Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --- .github/workflows/release.yml | 91 +++++++++++++++++++++++++++++++++++ cliff-release.toml | 80 ++++++++++++++++++++++++++++++ cliff.toml | 86 +++++++++++++++++++++++++++++++++ 3 files changed, 257 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 cliff-release.toml create mode 100644 cliff.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0a6bae1d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,91 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + type: string + description: New version number in X.Y.Z + required: true + +jobs: + update-master-branch: + runs-on: ubuntu-latest + steps: + - uses: everlytic/branch-merge@1.1.5 + with: + github_token: ${{ secrets.PAT }} + source_ref: 'develop' + target_branch: 'master' + commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}' + + release: + needs: [ 'update-master-branch' ] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Fetch repo + uses: actions/checkout@v4 + with: + ref: 'master' + fetch-depth: 0 + + - name: Get latest tag + id: latest_tag + shell: bash + run: | + echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT + - name: Generate a changelog + uses: orhun/git-cliff-action@v2 + id: generate-changelog + with: + config: ./cliff-release.toml + args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD + + - name: Create release and upload build + uses: softprops/action-gh-release@v1 + id: create-release + with: + name: v${{ github.event.inputs.version }} + tag_name: v${{ github.event.inputs.version }} + token: ${{ secrets.GITHUB_TOKEN }} + body: ${{ steps.generate-changelog.outputs.content }} + + update-changelog: + needs: [ 'release' ] + name: Generate changelog + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: 'master' + token: ${{ secrets.PAT }} + fetch-depth: 0 + + - name: Get latest tag + id: latest_tag + shell: bash + run: | + echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT + - name: Generate a changelog + uses: orhun/git-cliff-action@v2 + id: git-cliff + with: + config: cliff.toml + args: v0.0.0..${{ steps.latest_tag.outputs.TAG_NAME }} + env: + OUTPUT: ${{ github.workspace }}/CHANGELOG.md + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'docs(changelog): update changelog' + file_pattern: CHANGELOG.md + + - uses: everlytic/branch-merge@1.1.5 + with: + github_token: ${{ secrets.PAT }} + source_ref: 'master' + target_branch: 'develop' + commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}' diff --git a/cliff-release.toml b/cliff-release.toml new file mode 100644 index 00000000..3975df70 --- /dev/null +++ b/cliff-release.toml @@ -0,0 +1,80 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# What's Changed +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% for group, commits in commits | group_by(attribute="group") %}\ + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits + | filter(attribute="scope") + | sort(attribute="scope") %} + - **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}](/commit/{{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + + {%- endfor -%} + {%- for commit in commits %} + {%- if commit.scope -%} + {% else -%} + {% raw %}\n{% endraw %}\ + - {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}](/commit/{{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + + {% endif -%} + {% endfor -%} + {% raw %}\n{% endraw %} +{% endfor %}\n\ +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ +""" + +# postprocessors +postprocessors = [ + { pattern = '(\(/pull/[0-9]+\)\)) \| .+', replace = "${1}" }, + { pattern = '', replace = "https://github.com/mainsail-crew/crowsnest" }, # replace repository URL +] + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +filter_unconventional = true +# regex for parsing and grouping commits +commit_parsers = [ + # Commits to skip + { message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits + { message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits + + # Commits to parse + { message = "^feat(\\(.*\\))?:", group = "Features"}, + { message = "^feature(\\(.*\\))?:", group = "Features"}, + { message = "^fix(\\(.*\\))?:", group = "Bug Fixes and Improvements"}, + { message = "^perf(\\(.*\\))?:", group = "Performance"}, + { message = "^refactor(\\(.*\\))?:", group = "Refactor"}, + { message = "^style(\\(.*\\))?:", group = "Styling"}, + { message = "^locale(\\(.*\\))?:", group = "Localization"}, + { message = "^docs(\\(.*\\))?:", group = "Documentation"}, + { message = "^test(\\(.*\\))?:", group = "Other"}, + { message = "^chore(\\(.*\\))?:", group = "Other"}, + { body = ".*security", group = "Security"}, +] +commit_preprocessors = [ + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/pull/${2}))" }, +] +# filter out the commits that are not matched by commit parsers +filter_commits = true +ignore_tags="v*-(beta|rc)*" +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 00000000..6aa1d8bb --- /dev/null +++ b/cliff.toml @@ -0,0 +1,86 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ + +# Changelog +All notable changes to Crowsnest will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}](https://github.com/mainsail-crew/crowsnest/releases/tag/{{version}}) - {{ timestamp | date(format="%Y-%m-%d") }} +\ +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %}\ + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits + | filter(attribute="scope") + | sort(attribute="scope") %} + - **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}](/commit/{{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + {%- endfor -%} + {%- for commit in commits %} + {%- if commit.scope -%} + {% else -%} + {% raw %}\n{% endraw %}\ + - {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}](/commit/{{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + {% endif -%} + {% endfor -%} + {% raw %}\n{% endraw %} +{% endfor %}\n\ +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ +""" + +# postprocessors +postprocessors = [ + { pattern = '(\(/pull/[0-9]+\)\)) \| .+', replace = "${1}" }, + { pattern = '', replace = "https://github.com/mainsail-crew/crowsnest" }, # replace repository URL +] + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +filter_unconventional = false +# regex for parsing and grouping commits +commit_parsers = [ + # Commits to skip + { message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits + { message = "^chore\\(changelog\\): update changelog", group = "Changelog", skip = true}, # Old redundant commits + + # Commits to parse + { message = "^feat(\\(.*\\))?:", group = "Features"}, + { message = "^feature(\\(.*\\))?:", group = "Features"}, + { message = "^fix(\\(.*\\))?:", group = "Bug Fixes and Improvements"}, + { message = "^perf(\\(.*\\))?:", group = "Performance"}, + { message = "^refactor(\\(.*\\))?:", group = "Refactor"}, + { message = "^style(\\(.*\\))?:", group = "Styling"}, + { message = "^locale(\\(.*\\))?:", group = "Localization"}, + { message = "^docs(\\(.*\\))?:", group = "Documentation"}, + { message = "^test(\\(.*\\))?:", group = "Other"}, + { message = "^chore(\\(.*\\))?:", group = "Other"}, + { body = ".*security", group = "Security"}, +] +commit_preprocessors = [ + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/pull/${2}))" }, +] +# filter out the commits that are not matched by commit parsers +filter_commits = true +ignore_tags="v*-(beta|rc)*" +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" From 5c040f24c11284cb224fce232f5dcb38557c8b36 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:43:17 +0100 Subject: [PATCH 3/5] fix: add bookworm support (#195) --- bin/build.sh | 2 +- tools/configure.sh | 2 +- tools/install.sh | 6 ++++++ tools/libs/core.sh | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/build.sh b/bin/build.sh index 34c41d25..b4ee2cc4 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -39,7 +39,7 @@ fi # Camera-streamer repo CSTREAMER_PATH="camera-streamer" if [[ -z "${CROWSNEST_CAMERA_STREAMER_REPO_SHIP}" ]]; then - CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/ayufan-research/camera-streamer.git" + CROWSNEST_CAMERA_STREAMER_REPO_SHIP="https://github.com/ayufan/camera-streamer.git" fi if [[ -z "${CROWSNEST_CAMERA_STREAMER_REPO_BRANCH}" ]]; then CROWSNEST_CAMERA_STREAMER_REPO_BRANCH="master" diff --git a/tools/configure.sh b/tools/configure.sh index 5913659c..e0134cb6 100755 --- a/tools/configure.sh +++ b/tools/configure.sh @@ -28,7 +28,7 @@ CN_CONFIG_ENVPATH="${CN_CONFIG_ROOTPATH}/systemd" CN_MOONRAKER_CONFIG_PATH="${CN_CONFIG_CONFIGPATH}/moonraker.conf" CN_USTREAMER_REPO="https://github.com/pikvm/ustreamer.git" CN_USTREAMER_BRANCH="master" -CN_CAMERA_STREAMER_REPO="https://github.com/ayufan-research/camera-streamer.git" +CN_CAMERA_STREAMER_REPO="https://github.com/ayufan/camera-streamer.git" CN_CAMERA_STREAMER_BRANCH="master" ### Messages diff --git a/tools/install.sh b/tools/install.sh index 781c66dd..49e76514 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -128,6 +128,12 @@ main() { add_group_video + if [[ "$(is_bookworm)" = "1" ]]; then + msg "Bookworm detected!" + msg "Using main branch of camera-streamer for Bookworm..." + CROWSNEST_CAMERA_STREAMER_REPO_BRANCH="main" + fi + build_apps if [[ "${CROWSNEST_UNATTENDED}" = "0" ]]; then diff --git a/tools/libs/core.sh b/tools/libs/core.sh index c51a5aff..796ea1e9 100755 --- a/tools/libs/core.sh +++ b/tools/libs/core.sh @@ -34,6 +34,12 @@ is_buster() { fi } +is_bookworm() { + if [[ -f /etc/os-release ]]; then + grep -cq "bookworm" /etc/os-release &> /dev/null && echo "1" || echo "0" + fi +} + is_raspbian() { if [[ -f /boot/config.txt ]] && [[ -f /etc/rpi-issue ]]; then echo "1" From 293768fdca7ca70bac67f618cb213478483ec8c7 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Fri, 3 Nov 2023 12:06:44 +0100 Subject: [PATCH 4/5] fix(camera-streamer.sh): force camera to be always active (#197) Potentially fixes #139 --- libs/camera-streamer.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/camera-streamer.sh b/libs/camera-streamer.sh index 885557d6..765ad7d5 100755 --- a/libs/camera-streamer.sh +++ b/libs/camera-streamer.sh @@ -87,6 +87,9 @@ function run_ayucamstream() { # Enable camera-auto_reconnect by default start_param+=( --camera-auto_reconnect=1 ) + # Force camera to be always active by default + start_param+=( --camera-force_active=1 ) + # Custom Flag Handling (append to defaults) if [[ -n "${cstm}" ]]; then start_param+=( "${cstm}" ) From da536813054ae18f31e61ff406fb7ef09fcc4892 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Date: Fri, 3 Nov 2023 12:21:53 +0100 Subject: [PATCH 5/5] chore: add shellcheck run for PRs to develop (#198) --- .github/workflows/shellcheck.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index e9fc511c..fcb2f058 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -9,6 +9,7 @@ on: pull_request: branches: - 'master' + - 'develop' paths: - '**.sh' - 'webcamd'