1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/immich_ynh.git synced 2024-09-03 20:36:24 +02:00

Update ffmpeg-static version

This commit is contained in:
Sylvain 2024-08-27 08:01:15 +02:00
parent d5c53af3c4
commit ed8d81ccfb
3 changed files with 113 additions and 3 deletions

View file

@ -0,0 +1,54 @@
#!/bin/bash
#=================================================
# FETCHING LATEST SHA256SUM
#=================================================
# Fetching information
version_current=$(cat manifest.toml | tomlq -j '.version')
version_app=$(cat manifest.toml | tomlq -j '.version|split("~ynh")[0]')
version_ynh=$(cat manifest.toml | tomlq -j '.version|split("~ynh")[1]')
version_next="$version_app~ynh($version_ynh+1)"
repo=$(cat manifest.toml | tomlq -j '.upstream.code|split("https://github.com/")[1]')
amd64_url=$(cat manifest.toml | tomlq -j '.resources.sources.ffmpeg-static.amd64.url')
amd64_sha_current=$(cat manifest.toml | tomlq -j '.resources.sources.ffmpeg-static.amd64.sha256')
amd64_sha_last=$(curl --silent "$amd64_url" | sha256sum)
arm64_url=$(cat manifest.toml | tomlq -j '.resources.sources.ffmpeg-static.arm64.url')
arm64_sha_current=$(cat manifest.toml | tomlq -j '.resources.sources.ffmpeg-static.arm64.sha256')
arm64_sha_last=$(curl --silent "$arm64_url" | sha256sum)
# Setting up the environment variables
echo "Current version: $version_current"
echo "Latest version: $version_next"
echo "VERSION=$version_next" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if [ "$amd64_sha_current" == "$amd64_sha_last" ] And [ "$arm64_sha_current" == "$amd64_sha_last" ]
then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version_next ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
sed -i "s/^version = .*/version = \"$version_next\"/" manifest.toml
# Replace sha356sum in manifest
sed -i "s@^\"amd64.sha256\" = .*@\"amd64.sha256\" = \"$amd64_sha_last\"@" manifest.toml
sed -i "s@^\"arm64.sha256\" = .*@\"arm64.sha256\" = \"$arm64_sha_last\"@" manifest.toml
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -0,0 +1,56 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new ffmpeg-static releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install yq/tomlq
id: install_yq
run: pip install yq
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater_ffmpeg-static.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request to testing
id: cpr-testing
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -7,7 +7,7 @@ name = "Immich"
description.en = "Photo and video backup solution directly from your mobile phone" description.en = "Photo and video backup solution directly from your mobile phone"
description.fr = "Sauvegarde de photos et de vidéos directement depuis votre mobile" description.fr = "Sauvegarde de photos et de vidéos directement depuis votre mobile"
version = "1.112.1~ynh1" version = "1.112.1~ynh2"
maintainers = ["ewilly"] maintainers = ["ewilly"]
@ -49,9 +49,9 @@ ram.runtime = "500M"
[resources.sources.ffmpeg-static] [resources.sources.ffmpeg-static]
amd64.url = "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz" amd64.url = "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz"
amd64.sha256 = "5341ac10c505b9217740790d56d8e63e590d74ca81e3e56796e4c98f7be80b61" amd64.sha256 = "abda8d77ce8309141f83ab8edf0596834087c52467f6badf376a6a2a4c87cf67"
arm64.url = "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz" arm64.url = "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz"
arm64.sha256 = "7387f7aae3ae88cbaad5c66155fdf23ce0c0dbeaf4b1e573d704817938cd1b8e" arm64.sha256 = "f4149bb2b0784e30e99bdda85471c9b5930d3402014e934a5098b41d0f7201b1"
[resources.ports] [resources.ports]
main.default = 3001 main.default = 3001