-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
105 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Run plugin-cargo | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
push: | ||
branches: [ main, feat/* ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
RUST_LOG: info | ||
# database branch | ||
DATABASE: main | ||
BOT: 1 | ||
TAG_REPOS_DEFAULT: cache-v8.redb | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Generate list.json | ||
run: | | ||
wget https://github.com/os-checker/database/releases/download/${{ env.TAG_REPOS_DEFAULT }}/repos-default.json | ||
jq 'to_entries | map(.key) + ["os-checker/os-checker", "os-checker/os-checker.github.io"]' repos-default.json > list.json | ||
tree --help | ||
tree --gitignore -h | ||
- name: Install plugin-cargo | ||
run: cargo install --path . | ||
|
||
- name: Run plugin-cargo | ||
run: | | ||
os-checker-plugin-cargo # demo_jsons/list.json | ||
tree --gitignore -h tmp | ||
- name: Push to database | ||
env: | ||
PLUGIN_PATH: plugin/cargo | ||
run: | | ||
git config --global user.name "zjp-CN" | ||
git config --global user.email "[email protected]" | ||
git config --global committer.name "zjp-CN[bot]" | ||
git config --global committer.email "zjp-CN[bot]@users.noreply.github.com" | ||
echo "正在 clone os-checker/database" | ||
git clone https://x-access-token:${{ env.ACCESS_TOKEN }}@github.com/os-checker/database.git | ||
echo "成功 clone os-checker/database" | ||
cd database | ||
git switch ${{ env.DATABASE }} | ||
rm -rf ${{ env.PLUGIN_PATH }} | ||
mkdir -p ${{ env.PLUGIN_PATH }} | ||
mv ../tmp ${{ env.PLUGIN_PATH }}/info | ||
cp ../push.sh ${{ env.PLUGIN_PATH }} | ||
bash ${{ env.PLUGIN_PATH }}/push.sh | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "plugin-cargo" | ||
name = "os-checker-plugin-cargo" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ -n "$BOT" ]; then | ||
echo "更新 plugin/cargo 目录" | ||
|
||
export branch=$(git branch --show-current) | ||
|
||
echo "bot!" | ||
|
||
git status | ||
git add . | ||
echo "正在提交:$(git status --porcelain)" | ||
git commit -m "[bot] update plugin dir from os-checker-plugin-cargo repo" | ||
echo "提交成功,正在推送到 database 仓库(分支:$branch)" | ||
git push | ||
echo "成功推送到 database 仓库(分支:$branch)" | ||
fi | ||
|
||
echo 🎇 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters