.github/workflows/build.yaml #796
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
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| actions: write | |
| pages: write | |
| env: | |
| bin: target/release/bot | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| jobs: | |
| Compile: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - run: | | |
| cargo build --release | |
| gh release create bot || true | |
| gh release upload bot $bin --clobber | |
| if: github.event_name == 'push' | |
| Prepare: | |
| needs: Compile | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: | | |
| gh release download bot -R $GITHUB_REPOSITORY | |
| sudo chmod a+x bot | |
| ./bot > market.json | |
| rm bot | |
| - uses: actions/configure-pages@v5 | |
| - uses: actions/jekyll-build-pages@v1 | |
| - uses: actions/upload-pages-artifact@v3 | |
| if: ${{!failure()}} | |
| Publish: | |
| needs: Prepare | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{steps.deployment.outputs.page_url}} | |
| steps: | |
| - uses: actions/deploy-pages@v4 | |
| if: ${{!failure()}} | |
| Sustain: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: gh workflow enable build.yaml | |
| env: | |
| GH_REPO: ${{github.repository}} |