mirror of
https://github.com/YunoHost-Apps/calibreweb_ynh.git
synced 2024-09-03 18:16:20 +02:00
commit
3d6385a2a5
2 changed files with 15 additions and 10 deletions
21
.github/workflows/updater.sh
vendored
21
.github/workflows/updater.sh
vendored
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
==========================================
|
#==========================================
|
||||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
@ -35,14 +35,15 @@ echo "VERSION=$version" >> $GITHUB_ENV
|
||||||
echo "REPO=$repo" >> $GITHUB_ENV
|
echo "REPO=$repo" >> $GITHUB_ENV
|
||||||
echo "Current version for kepubify: $current_version_kepubify"
|
echo "Current version for kepubify: $current_version_kepubify"
|
||||||
echo "Latest release from upstream for kepubify: $version_kepubify"
|
echo "Latest release from upstream for kepubify: $version_kepubify"
|
||||||
echo "VERSION=$version" >> $GITHUB_ENV
|
echo "VERSION_KEPUBIFY=$version_kepubify" >> $GITHUB_ENV
|
||||||
echo "REPO=$repo" >> $GITHUB_ENV
|
echo "REPO_KEPUBIFY=$repo_kepubify" >> $GITHUB_ENV
|
||||||
# For the time being, let's assume the script will fail
|
# For the time being, let's assume the script will fail
|
||||||
echo "PROCEED=false" >> $GITHUB_ENV
|
echo "PROCEED=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
# Proceed only if the retrieved version is greater than the current one
|
# Proceed only if the retrieved version is greater than the current one
|
||||||
update_upstream=1
|
update_upstream=1
|
||||||
update_kepubify=1
|
update_kepubify=1
|
||||||
|
|
||||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||||
echo "::warning ::No new version available for upstream app"
|
echo "::warning ::No new version available for upstream app"
|
||||||
update_upstream=0
|
update_upstream=0
|
||||||
|
@ -61,11 +62,13 @@ elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.
|
||||||
update_kepubify=0
|
update_kepubify=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$update_kepubify"=0 ] && [ "$update_upstream"=0 ]; then
|
if [ "$update_kepubify" == 0 ] && [ "$update_upstream" == 0 ]; then
|
||||||
|
echo "::no update : exit"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$update_upstream"=1 ]; then
|
if [ "$update_upstream" == 1 ]; then
|
||||||
|
echo "Update upstream"
|
||||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
||||||
echo "${#assets[@]} available asset(s)"
|
echo "${#assets[@]} available asset(s)"
|
||||||
|
|
||||||
|
@ -122,8 +125,10 @@ EOT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$update_kepubify"=1 ]; then
|
if [ "$update_kepubify" == 1 ]; then
|
||||||
|
echo "Update kepubify"
|
||||||
for asset_url_kepubify in ${assets_kepubify[@]}; do
|
for asset_url_kepubify in ${assets_kepubify[@]}; do
|
||||||
|
|
||||||
echo "Handling asset at $asset_url_kepubify"
|
echo "Handling asset at $asset_url_kepubify"
|
||||||
|
@ -192,12 +197,12 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ "$update_upstream"=1 ]; then
|
if [ "$update_upstream" == 1 ]; then
|
||||||
# Replace new version in manifest
|
# Replace new version in manifest
|
||||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||||
echo "$(jq -s --indent 4 ".[] | .upstream.version = \"$version\"" manifest.json)" > manifest.json
|
echo "$(jq -s --indent 4 ".[] | .upstream.version = \"$version\"" manifest.json)" > manifest.json
|
||||||
fi
|
fi
|
||||||
if [ "$update_kepubify"=1 ] && [ "$update_upstream"=0 ]; then
|
if [ "$update_kepubify" == 1 ] && [ "$update_upstream" == 0 ]; then
|
||||||
new_yunohost_package_version=$(("$current_yunohost_package_version+1"))
|
new_yunohost_package_version=$(("$current_yunohost_package_version+1"))
|
||||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh$new_yunohost_package_version\"" manifest.json)" > manifest.json
|
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh$new_yunohost_package_version\"" manifest.json)" > manifest.json
|
||||||
fi
|
fi
|
||||||
|
|
4
.github/workflows/updater.yml
vendored
4
.github/workflows/updater.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Fetch the source code
|
- name: Fetch the source code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Run the updater script
|
- name: Run the updater script
|
||||||
|
@ -33,7 +33,7 @@ jobs:
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
id: cpr
|
id: cpr
|
||||||
if: ${{ env.PROCEED == 'true' }}
|
if: ${{ env.PROCEED == 'true' }}
|
||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
commit-message: Update to version ${{ env.VERSION }}
|
commit-message: Update to version ${{ env.VERSION }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue