ci: push to main database branch #20
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
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"]' repos-default.json > list.json | |
tree --help | |
tree --gitignore -h | |
- name: Install cargo-nextest | |
run: | | |
wget https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.81/cargo-nextest-0.9.81-x86_64-unknown-linux-gnu.tar.gz | |
tar xzvf cargo-nextest-0.9.81-x86_64-unknown-linux-gnu.tar.gz | |
mv cargo-nextest ~/.cargo/bin | |
- name: Install plugin-cargo | |
run: cargo install --path . | |
- name: Run plugin-cargo | |
run: | | |
os-checker-plugin-cargo #os-checker.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 | |