fix(ci): remove DMG maker (fails on GitHub Actions) #40
Workflow file for this run
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: Sync Tutorial File | |
| on: | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| sync-tutorial: | |
| name: Sync TUTORIAL.md | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # Required to push changes back to the pull request branch | |
| contents: write | |
| steps: | |
| - name: Checkout Athanor repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # Checkout the actual PR branch, not a detached head | |
| ref: ${{ github.head_ref }} | |
| - name: Checkout website repository for docs | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: lacerbi/athanor-website | |
| path: .docs-repo # Clone into a temporary subfolder | |
| - name: Build TUTORIAL.md from website docs | |
| run: | | |
| TUTORIAL_FILE_PATH="${{ github.workspace }}/TUTORIAL.md" | |
| DOCS_SOURCE_DIR=".docs-repo/docs/tutorial" | |
| # Write the new header | |
| echo "**For the most up-to-date tutorial information, videos and materials, check out the [website](https://athanor.works/).**" > "$TUTORIAL_FILE_PATH" | |
| echo "" >> "$TUTORIAL_FILE_PATH" | |
| echo "---" >> "$TUTORIAL_FILE_PATH" | |
| # Find, sort naturally, and concatenate the .md files, stripping frontmatter | |
| # 'ls -v' correctly sorts numbers in filenames (e.g., 2 before 10) | |
| # Use array to track files so we can detect the last one | |
| files=($(ls -v $DOCS_SOURCE_DIR/*.md)) | |
| for ((i=0; i<${#files[@]}; i++)); do | |
| file="${files[i]}" | |
| # Strip Docusaurus-style frontmatter (a block at the start of the file | |
| # enclosed by '---' lines) before appending. | |
| # This awk script handles files with and without frontmatter gracefully. | |
| awk ' | |
| # If its the first line and is a ''---'' delimiter, start header mode and skip the line. | |
| NR==1 && /^[[:space:]]*---[[:space:]]*$/ { in_header=1; next } | |
| # If in header mode and we see the closing ''---'', exit header mode and skip the line. | |
| in_header && /^[[:space:]]*---[[:space:]]*$/ { in_header=0; next } | |
| # If not in header mode, print the line. | |
| !in_header { print } | |
| ' "$file" >> "$TUTORIAL_FILE_PATH" | |
| echo "" >> "$TUTORIAL_FILE_PATH" # Add a newline between files | |
| # Add separator after each file except the last one | |
| if [ $i -lt $((${#files[@]} - 1)) ]; then | |
| echo "---" >> "$TUTORIAL_FILE_PATH" | |
| echo "" >> "$TUTORIAL_FILE_PATH" | |
| fi | |
| done | |
| # Replace image paths to match Athanor repository structure | |
| sed -i 's|/img/tutorial/|/resources/images/tutorial/|g' "$TUTORIAL_FILE_PATH" | |
| echo "TUTORIAL.md has been rebuilt." | |
| - name: Commit and push changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add TUTORIAL.md | |
| # Check if there are staged changes. If so, commit and push. | |
| if ! git diff --staged --quiet; then | |
| git commit -m "docs(tutorial): Sync TUTORIAL.md from website repository" -m "Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | |
| git push | |
| echo "Pushed updated TUTORIAL.md to the PR branch." | |
| else | |
| echo "TUTORIAL.md is already up-to-date. No changes to commit." | |
| fi |