Update generateCourseOverview.yml #42
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: Regenerate course overview | |
| on: | |
| repository_dispatch: | |
| types: [new_version] | |
| push: | |
| # Allows you to run this workflow manually from the Actions tab | |
| # workflow_dispatch: | |
| env: | |
| EXPORTFOLDER: 'assets' | |
| REPOSITORYFOLDER: 'repository' | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out current repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
| fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
| path: repository | |
| - name: Delete and redefine folder for exports | |
| run: | | |
| rm -rf ${REPOSITORYFOLDER}/${EXPORTFOLDER} | |
| mkdir -p ${REPOSITORYFOLDER}/${EXPORTFOLDER} | |
| - name: Cache repository | |
| uses: actions/cache@v3 | |
| with: | |
| path: repository | |
| key: repository-${{ github.sha }} | |
| run_index: | |
| needs: prepare | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Restore repository | |
| uses: actions/cache@v3 | |
| with: | |
| path: repository | |
| key: repository-${{ github.sha }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| # Removed npm cache that was causing failures | |
| - name: Install LiaScript exporter | |
| run: npm install -g @liascript/exporter | |
| - name: Run exporter for index | |
| run: | | |
| cd ${REPOSITORYFOLDER} | |
| liaex -i index.yml -o index --format project --project-category-blur | |
| ls | |
| commit: | |
| needs: | |
| [run_index] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Restore repository | |
| uses: actions/cache@v3 | |
| with: | |
| path: repository | |
| key: repository-${{ github.sha }} | |
| - name: Commit files | |
| run: | | |
| cd ${REPOSITORYFOLDER} | |
| ls | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add . | |
| git commit -m "Add new export version of courses" || echo "No changes to commit" | |
| - name: Push changes | |
| uses: ad-m/github-push-action@master | |
| with: | |
| directory: repository | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} |