C# Compiler #91
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: Powershell Compiler | |
| on: | |
| push: | |
| branches: [master] | |
| paths: [ "src/**/*.ps1", ".github/workflows/compile-scripts.yaml" ] | |
| pull_request: | |
| paths: [ "src/**/*.ps1", ".github/workflows/compile-scripts.yaml" ] | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| compiled: ${{ steps.changes.outputs.compiled }} | |
| src: ${{ steps.changes.outputs.src }} | |
| src_deleted: ${{ steps.changes.outputs.src_deleted }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Checks for changes in the 'compiled' and 'src' directories | |
| # We also check for deleted files so we can cleanup the compiled directory | |
| - name: Collect Changes for Upcoming Jobs | |
| uses: dorny/[email protected] | |
| id: changes | |
| with: | |
| list-files: shell | |
| filters: | | |
| compiled: | |
| - 'compiled/**' | |
| src: | |
| - 'src/**/*.(ps1|psm1)' | |
| src_deleted: | |
| - deleted: 'src/**/*.(ps1|psm1)' | |
| cleanup-directory: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.src_deleted == 'true' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # TODO - Use a git diff to determine which files were deleted | |
| - name: Delete Compiled versions of deleted files | |
| id: delete_files | |
| run: | | |
| shopt -s globstar nullglob | |
| for file in compiled/**/*; do | |
| no_prefix=${file#compiled/} | |
| if [ ! -f "src/${no_prefix}" ]; then | |
| echo "FOUND_DELETED=true" >> "$GITHUB_OUTPUT" | |
| echo "Found deleted src file ${no_prefix}, deleting compiled version." | |
| rm "$file" | |
| fi | |
| done | |
| - name: Commit Changes | |
| if: ${{ steps.delete_files.outputs.FOUND_DELETED == 'true' && github.event_name == 'push' }} | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "chore(compiled): Remove compiled versions of deleted files" | |
| build: | |
| uses: ./.github/workflows/build.yaml | |
| compile-scripts: | |
| runs-on: windows-latest | |
| needs: [changes, build] | |
| if: ${{ needs.changes.outputs.src == 'true' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download Compiler Artifact | |
| uses: dawidd6/action-download-artifact@v6 | |
| with: | |
| workflow: build.yaml | |
| workflow_conclusion: success | |
| name: Compiler | |
| path: /tmp/Compiler | |
| - name: Run Compiler | |
| shell: pwsh | |
| run: /tmp/Compiler/Compiler.exe --input src --output compiled --force -vvv -f | |
| - name: Commit Changes | |
| if: ${{ needs.changes.outputs.src == 'true' && github.event_name == 'push' }} | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "chore(compiled): Compile scripts" |