subscribe update #1598
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: subscribe update | |
on: | |
# push: | |
# branches: [ "main" ] | |
schedule: | |
- cron: '07 */8 * * *' | |
workflow_dispatch: | |
inputs: | |
bin_flag: | |
type: string | |
required: true | |
env: | |
TMP_BUILD_DIR: ${{ github.workspace }}/orepo/v2speed/target/release | |
RUN_FLAG: "${{ github.event.inputs.bin_flag || '' }}" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: setup rust and go | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.19.0' | |
- run: | | |
rustc --version | |
go version | |
- name: make env | |
run: | | |
git --version | |
mkdir orepo | |
cd orepo | |
echo "archive=$(echo "zip")" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'ts-sf/v2tool' | |
path: '${{ github.workspace }}/orepo/v2tool' | |
ref: 'dev' | |
- uses: actions/checkout@v4 | |
with: | |
repository: '${{ secrets.ROMOTE_REPO }}' | |
token: '${{ secrets.PERSONAL_TOKEN }}' | |
path: '${{ github.workspace }}/orepo/v2speed' | |
- name: build | |
run: | | |
cd ${{ github.workspace }}/orepo/v2tool | |
# ls | |
# $bin = "${{ github.workspace }}/target/release" | |
go mod tidy | |
go build -o ${{ env.TMP_BUILD_DIR }}/v2tool | |
cd ${{ github.workspace }}/orepo/v2speed | |
cargo build --release | |
chmod 777 run.sh | |
mv run.sh ${{ env.TMP_BUILD_DIR }} | |
- name: run | |
run: | | |
cd ${{ env.TMP_BUILD_DIR }} | |
./run.sh ${{ env.RUN_FLAG }} | |
[ -f ${{ env.TMP_BUILD_DIR }}/out.png ] && mv ${{ env.TMP_BUILD_DIR }}/out.png ${{ github.workspace }}/traffic.png | |
[ -e ${{ github.workspace }}/addition ] && rm -rf ${{ github.workspace }}/addition | |
[ -f ${{ github.workspace }}/v2 ] && rm ${{ github.workspace }}/v2* | |
[ -f ${{ github.workspace }}/clash ] && rm ${{ github.workspace }}/clash* | |
mv ${{ env.TMP_BUILD_DIR }}/data/main/* ${{ github.workspace }}/ | |
- name: commit changes | |
run: | | |
cd ${{ github.workspace }} | |
git config user.email "[email protected]" | |
git config user.name "Github Actions" | |
git add . | |
git commit -m "🚀 $(date -d '-8 hours ago' "+%Y-%m-%d %H:%M:%S")" | |
- name: push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PERSONAL_TOKEN }} | |
- name: checkout speed | |
uses: actions/checkout@v4 | |
with: | |
ref: speed | |
path: 'orepo/speed' | |
- name: commit and push speed | |
run: | | |
cd ${{ github.workspace }}/orepo/speed | |
[ -f v2 ] && rm v2* | |
[ -f clash ] && rm clash* | |
[ -f README.md ] && rm README.md | |
[ -e addition ] && rm -rf addition | |
mv ${{ env.TMP_BUILD_DIR }}/data/speed/* ${{ github.workspace }}/orepo/speed/ | |
git config user.email "[email protected]" | |
git config user.name "Github Actions" | |
git add . | |
git commit -m "♻ $(date -d '-8 hours ago' "+%Y-%m-%d %H:%M:%S")" | |
git push https://${{secrets.PERSONAL_TOKEN}}@github.com/ts-sf/fly.git speed |