Publish fresh transcript #7532
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
| # Zero-Clause BSD License | |
| # Copyright (C) 2025 Toit contributors | |
| # Permission to use, copy, modify, and/or distribute this software for any | |
| # purpose with or without fee is hereby granted. | |
| # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
| # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| # FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
| # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
| # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | |
| # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
| # PERFORMANCE OF THIS SOFTWARE. | |
| name: Publish fresh transcript | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Every hour. | |
| workflow_dispatch: | |
| inputs: | |
| clear-cache: | |
| description: 'Clear the cache.' | |
| required: false | |
| default: false | |
| type: boolean | |
| push: | |
| branches: | |
| - main | |
| env: | |
| GUILD_ID: '918498540232253480' # Toit | |
| TOIT_VERSION: 'v2.0.0-alpha.175' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Clear cache | |
| # Clearing the cache means that all threads will be downloaded again. | |
| # Once we have a lot of threads, we might want to avoid this for every | |
| # push to main. | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event.inputs.clear-cache == 'true' | |
| run: | | |
| rm -rf transcripts | |
| - name: Generate transcript | |
| uses: toitlang/action-discord-transcript@v1.3.1 | |
| with: | |
| discord-token: ${{ secrets.DISCORD_TRANSCRIPT_TOKEN }} | |
| guild-id: ${{ env.GUILD_ID }} | |
| transcript-directory: transcripts | |
| - name: Commit and push | |
| run: | | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| git add transcripts | |
| git commit -m "Update transcripts" | |
| git push | |
| - name: Install Toit | |
| uses: toitlang/action-setup@v1 | |
| with: | |
| toit-version: ${{ env.TOIT_VERSION }} | |
| - name: Create build directory | |
| run: | | |
| mkdir build | |
| cp -r assets build/ | |
| cp -r transcripts build/ | |
| - name: Build | |
| working-directory: bin | |
| run: | | |
| toit pkg install | |
| toit main.toit --transcripts-dir=transcripts ${{ github.workspace }}/build | |
| - name: "Upload to gh-pages" | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: build | |
| cname: help.toit.io |