Skip to content

Commit 48a127f

Browse files
Auto bump pinned version (#130)
* Create script and workflow * Update workflow name and trigger * Update endpoint Thanks @katrinafyi for the idea * Better error handling * Only set git user in CI
1 parent b81f038 commit 48a127f

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Bump lychee version
2+
3+
on:
4+
repository_dispatch:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: "00 18 * * *"
8+
9+
jobs:
10+
bumpLycheeVersion:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
15+
- name: Bump lychee version
16+
run: ./bump-lychee.sh
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

bump-lychee.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! /usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
LATEST=$(curl --fail "https://api.github.com/repos/lycheeverse/lychee/releases/latest" | jq -er ".name")
6+
FILE=src/generate/lychee-version.ts
7+
8+
sed -i -e "s/LYCHEE_VERSION = \"[^\"]*\"/LYCHEE_VERSION = \"$LATEST\"/" $FILE
9+
10+
if [ -n "$CI" ]; then
11+
git config user.name "lychee bot"
12+
git config user.email "noreply@lychee.cli.rs"
13+
fi
14+
15+
if git status --porcelain | grep $FILE; then
16+
echo New version found: $LATEST
17+
git add $FILE
18+
BRANCH="bump-$LATEST"
19+
MESSAGE="Bump lychee: $LATEST"
20+
git checkout -b $BRANCH
21+
git add $FILE
22+
git commit --message "$MESSAGE"
23+
git push -u origin $BRANCH
24+
gh pr create -B master -H $BRANCH --title "$MESSAGE" --body 'Created by Github action'
25+
else
26+
echo Version is up to date
27+
fi

0 commit comments

Comments
 (0)