diff --git a/.github/workflows/bump-lychee-version.yml b/.github/workflows/bump-lychee-version.yml new file mode 100644 index 0000000..5ea9275 --- /dev/null +++ b/.github/workflows/bump-lychee-version.yml @@ -0,0 +1,18 @@ +name: Bump lychee version + +on: + repository_dispatch: + workflow_dispatch: + schedule: + - cron: "00 18 * * *" + +jobs: + bumpLycheeVersion: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Bump lychee version + run: ./bump-lychee.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/bump-lychee.sh b/bump-lychee.sh new file mode 100755 index 0000000..b4a3178 --- /dev/null +++ b/bump-lychee.sh @@ -0,0 +1,23 @@ +#! /usr/bin/env bash + +POSITION=1 # 0 is nightly, 1 is latest stable release +LATEST=$(curl "https://api.github.com/repos/lycheeverse/lychee/releases" | jq -r ".[$POSITION] | .name") +FILE=src/generate/lychee-version.ts + +sed -i -e "s/LYCHEE_VERSION = \"[^\"]*\"/LYCHEE_VERSION = \"$LATEST\"/" $FILE + +if git status --porcelain | grep $FILE; then + echo New version found: $LATEST + git add $FILE + BRANCH="bump-$LATEST" + MESSAGE="Bump lychee: $LATEST" + git checkout -b $BRANCH + git add $FILE + git config user.name "lychee bot" + git config user.email "noreply@lychee.cli.rs" + git commit --message "$MESSAGE" + git push -u origin $BRANCH + gh pr create -B master -H $BRANCH --title "$MESSAGE" --body 'Created by Github action' +else + echo Version is up to date +fi