Update main.yml #8
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: Binary Encoder/Decoder Build and Run | |
| on: | |
| push: | |
| paths: | |
| - '**/*.py' | |
| - '**/*.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| run-binary-py: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Run Values for encoding | |
| run: | | |
| cat <<EOF > encode.txt | |
| encode | |
| Hello World! | |
| EOF | |
| - name: Run Binary Encoder | |
| run: | | |
| echo -e " Encode Output:\n" > Test-Run-Result/Result.txt | |
| python binarypy.py < encode.txt | tee encode_output.txt >> Test-Run-Result/Result.txt | |
| - name: Run Values for decoding | |
| run: | | |
| echo "decode" > decode.txt | |
| tail -n 1 encode_output.txt >> decode.txt | |
| cat decode.txt | |
| - name: Run Binary Decoder | |
| run: | | |
| echo -e "\n\nDecode Output:\n" >> Test-Run-Result/Result.txt | |
| python binarypy.py < decode.txt >> Test-Run-Result/Result.txt | |
| - name: Upload Binary Encoder Decoder Test Run Results to Repo | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Push Binary Encoder Decoder Test-Run-Result | |
| path: Test-Run-Result/Result.txt | |
| - name: Push Result.txt to Repo | |
| env: | |
| TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }} | |
| git add Test-Run-Result/Result.txt | |
| git commit -m "Update Binary Encoder Decoder output [skip ci]" || echo "No changes to commit" | |
| git push |