mirror of
https://github.com/YunoHost-Apps/snweb_ynh.git
synced 2024-09-03 20:26:22 +02:00
Update: ci-auto-update scripts
This commit is contained in:
parent
a2a18bc441
commit
f4c54892a4
2 changed files with 18 additions and 12 deletions
21
.github/workflows/updater.sh
vendored
21
.github/workflows/updater.sh
vendored
|
@ -18,10 +18,19 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
|||
current_ynh_version=$(cat manifest.json | jq -j '.version|split("~ynh")[1]')
|
||||
current_commit=$(cat scripts/_common.sh | awk -F= '/^COMMIT/ { print $2 }')
|
||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
tag_version=$(curl --silent "https://api.github.com/repos/$repo/tags" | jq -r '.[] | .name' | grep -v "@standardnotes" | sort -V | tail -1)
|
||||
version=$(curl --silent "https://raw.githubusercontent.com/$repo/$tag_version/package.json" | jq -j '.version')
|
||||
|
||||
page=0
|
||||
tag_version=""
|
||||
while [ -z $tag_version ]
|
||||
do
|
||||
let page++
|
||||
tag_version=$(curl --silent "https://api.github.com/repos/$repo/tags?per_page=100&page=$page" | jq -r '.[] | .name' | grep -v "alpha" | grep "@standardnotes/web@" | sort -V | tail -1)
|
||||
|
||||
done
|
||||
|
||||
version=$(curl --silent "https://raw.githubusercontent.com/$repo/$tag_version/packages/web/package.json" | jq -j '.version')
|
||||
asset="https://github.com/$repo/archive/refs/tags/$tag_version.tar.gz"
|
||||
commit=$(curl --silent "https://api.github.com/repos/$repo/tags" | jq -r '[ .[] | select(.name=="'$tag_version'").commit.sha ] | join(" ") | @sh' | tr -d "'")
|
||||
commit=$(curl --silent "https://api.github.com/repos/$repo/tags?per_page=100&page=$page" | jq -r '[ .[] | select(.name=="'$tag_version'").commit.sha ] | join(" ") | @sh' | tr -d "'")
|
||||
|
||||
# Later down the script, we assume the version has only digits and dots
|
||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||
|
@ -76,7 +85,7 @@ else
|
|||
fi
|
||||
|
||||
# Rewrite source file
|
||||
cat <<EOT > conf/$src.src
|
||||
cat <<EOT > conf/app.src
|
||||
SOURCE_URL=$asset
|
||||
SOURCE_SUM=$checksum
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
|
@ -84,7 +93,7 @@ SOURCE_FORMAT=$extension
|
|||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
echo "... conf/app.src updated"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
|
@ -111,5 +120,3 @@ echo "$(jq -s --indent 4 ".[] | .version = \"$new_version\"" manifest.json)" > m
|
|||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
||||
|
||||
|
||||
|
|
9
.github/workflows/updater.yml
vendored
9
.github/workflows/updater.yml
vendored
|
@ -29,22 +29,21 @@ jobs:
|
|||
id: commit
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
run: |
|
||||
git commit -am "Upgrade to version $VERSION - tag $TAG_VERSION"
|
||||
git commit -am "Upgrade to version $VERSION"
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: 'Update: Update to version ${{ env.VERSION }} - tag ${{ env.TAG_VERSION }}'
|
||||
commit-message: 'Update: 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 }}-tag${{ env.TAG_VERSION }}
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }} - tag ${{ env.TAG_VERSION }}'
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to version ${{ env.VERSION }}
|
||||
Upgrade to tag ${{ env.TAG_VERSION }}
|
||||
draft: false
|
||||
|
|
Loading…
Add table
Reference in a new issue