Improve delay of delayed runs #1905
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: Deploy documentation | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: deploy-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: docs | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| package_json_file: docs/package.json | |
| - name: Use Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: 26 | |
| cache: "pnpm" | |
| cache-dependency-path: docs/pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Deploy to SFTP | |
| if: github.ref == 'refs/heads/develop' | |
| env: | |
| SFTP_HOST: ${{ secrets.SFTP_HOST }} | |
| SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }} | |
| SFTP_KEY: ${{ secrets.SFTP_KEY }} | |
| SFTP_KNOWN_HOSTS: ${{secrets.SFTP_KNOWN_HOSTS}} | |
| run: | | |
| echo "$SFTP_KEY" > sftp_key | |
| chmod 600 sftp_key | |
| echo "$SFTP_KNOWN_HOSTS" > known_hosts | |
| chmod 600 known_hosts | |
| rsync -avz --delete -e "ssh -i sftp_key -o UserKnownHostsFile=known_hosts" dist/ $SFTP_USERNAME@$SFTP_HOST:/var/www/butterfly.linwood | |
| web: | |
| runs-on: ubuntu-26.04 | |
| timeout-minutes: 60 | |
| defaults: | |
| run: | |
| working-directory: app | |
| steps: | |
| - name: 猬嗭笍 Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: subosito/flutter-action@v2.23.0 | |
| with: | |
| flutter-version-file: app/pubspec.yaml | |
| cache: true | |
| - name: Install dependencies | |
| run: | | |
| flutter pub get | |
| - name: Install OneNote web toolchain | |
| run: | | |
| rustup toolchain install nightly --component rust-src | |
| cargo install wasm-pack --locked | |
| - name: Build OneNote web library | |
| working-directory: . | |
| run: dart run tools/build_onenote_web.dart | |
| - name: Get Git Commit Hash | |
| run: echo "GIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_ENV" | |
| - name: Set flavor | |
| if: github.ref != 'refs/heads/main' | |
| run: | | |
| echo "SETONIX_FLAVOR=nightly" >> $GITHUB_ENV | |
| echo "WEB_DIR=preview" >> $GITHUB_ENV | |
| cp -rf web_nightly/* web/ | |
| - name: Set flavor | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| echo "SETONIX_FLAVOR=stable" >> $GITHUB_ENV | |
| echo "WEB_DIR=web" >> $GITHUB_ENV | |
| - name: Build | |
| run: flutter build web --wasm --release --no-web-resources-cdn --dart-define=flavor=$SETONIX_FLAVOR --dart-define=version=$GIT_HASH | |
| - name: Deploy to SFTP | |
| if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' | |
| env: | |
| SFTP_HOST: ${{ secrets.SFTP_HOST }} | |
| SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }} | |
| SFTP_KEY: ${{ secrets.SFTP_KEY }} | |
| SFTP_KNOWN_HOSTS: ${{secrets.SFTP_KNOWN_HOSTS}} | |
| run: | | |
| echo "$SFTP_KEY" > sftp_key | |
| chmod 600 sftp_key | |
| echo "$SFTP_KNOWN_HOSTS" > known_hosts | |
| chmod 600 known_hosts | |
| rsync -avz --delete -e "ssh -i sftp_key -o UserKnownHostsFile=known_hosts" build/web/ $SFTP_USERNAME@$SFTP_HOST:/var/www/$WEB_DIR.butterfly.linwood |