Check Updates #37
This file contains hidden or 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: Check OpenList Version | |
| on: | |
| schedule: | |
| - cron: "0 5,17 * * *" # 每日5点和17点执行 | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "master" | |
| paths: | |
| - "sync_openlist.yaml" | |
| permissions: | |
| contents: write | |
| actions: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| VERSION_FILE: ${{ github.workspace }}/openlist_version | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - run: | | |
| cd $GITHUB_WORKSPACE/.github/scripts | |
| chmod +x ./*.sh | |
| touch ${{ env.VERSION_FILE }} | |
| ./check_openlist.sh | |
| - name: Change OpenList Version | |
| run: | | |
| echo "openlist_version=${{ env.openlist_version }}" | |
| echo "openlist_update=${{ env.openlist_update }}" | |
| # 用于测试 | |
| # echo "openlist_update=1" >> $GITHUB_ENV | |
| if [ ${{ env.openlist_update }} -eq 0 ] | |
| then | |
| echo "无更新" | |
| else | |
| echo -e "[自动同步OpenList] ${{ env.openlist_version }}" > $GITHUB_WORKSPACE/CHANGELOG.md | |
| echo -e "${{ env.openlist_version }}" > ${{ env.VERSION_FILE }} | |
| # 更新pubspec.yaml中的版本号 | |
| chmod +x $GITHUB_WORKSPACE/.github/scripts/update_pubspec_version.sh | |
| $GITHUB_WORKSPACE/.github/scripts/update_pubspec_version.sh | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "[bot] Update openlist to ${{ env.openlist_version }}" | |
| git push | |
| fi | |
| - name: Run workflow release | |
| if: env.openlist_update == 1 && ( success() || failure() ) | |
| run: | | |
| gh workflow run release.yaml -R OpenListTeam/OpenList-Mobile | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |