Skip to content

Commit ba8493e

Browse files
committed
Create script and workflow
1 parent 3af627b commit ba8493e

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

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

bump-lychee.sh

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

0 commit comments

Comments
 (0)