Skip to content

Commit

Permalink
fix: check new version
Browse files Browse the repository at this point in the history
  • Loading branch information
martabal committed Jun 11, 2024
1 parent 5154253 commit e3de257
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/external-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Check for new version
on:
schedule:
- cron: "*/20 * * * *"
push:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -25,7 +27,45 @@ jobs:
id: check_version
run: |
current_version=$(curl -sL https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/latest | jq -r '.tag_name')
counter=0
# Loop until current_version is not "null" or counter reaches 10
while [ $counter -lt 10 ]; do
current_version=$(curl -sL https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases/latest | jq -r '.tag_name')
# Check if current_version is not "null"
if [ "$current_version" != "null" ]; then
echo "current_version is not null: $current_version"
break
else
echo "current_version is still null, retrying in 10 seconds..."
sleep 10
((counter++))
fi
done
if [ "$current_version" = "null" ]; then
echo "current_version is still null after 10 attempts, exiting..."
exit 1
fi
immich_version=$(curl -sL https://api.github.com/repos/immich-app/immich/releases/latest | jq -r '.tag_name')
counter=0
# Loop until immich_version is not "null" or counter reaches 10
while [ $counter -lt 10 ]; do
immich_version=$(curl -sL https://api.github.com/repos/immich-app/immich/releases/latest | jq -r '.tag_name')
# Check if immich_version is not "null"
if [ "$immich_version" != "null" ]; then
echo "immich_version is not null: $immich_version"
break
else
echo "immich_version is still null, retrying in 10 seconds..."
sleep 10
((counter++))
fi
done
if [ "$immich_version" = "null" ]; then
echo "immich_version is still null after 10 attempts, exiting..."
exit 1
fi
if [ -z "$current_version" ] || [ -z "$immich_version" ]; then
echo "Error: One of the versions is null."
exit 1
Expand Down Expand Up @@ -68,6 +108,7 @@ jobs:
--notes "Read Immich release notes [here](https://github.com/immich-app/immich/releases/tag/${{ needs.check_new_version.outputs.immich_version }})"
- name: Trigger workflow
if: github.event_name != 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run docker.yml -f version=${{ needs.check_new_version.outputs.immich_version }}

0 comments on commit e3de257

Please sign in to comment.