diff --git a/action.yml b/action.yml index f4b2b9e80..edb40bf70 100644 --- a/action.yml +++ b/action.yml @@ -6,12 +6,9 @@ inputs: description: Target repository required: false default: ${{ github.repository }} - upload-built-template: + library-name: required: false - default: true - project-name: - required: false - default: ${{ github.repository }} + default: null runs: using: composite @@ -24,7 +21,7 @@ runs: - run: cp -r ./pros-project/* ./ # its incredibly silly that I have to do this but otherwise it interferes with other checkouts shell: bash - - name: Check if template + - name: Check If Template id: template run: | template=$(awk -F'=' '/^IS_LIBRARY:=/{print $2}' Makefile) @@ -34,15 +31,15 @@ runs: TEMPLATE: ${{ steps.template.outputs.template }} shell: bash - - name: Get project info - if: ${{ steps.template.outputs.template == 1 && inputs.upload-built-template == true }} + - name: Get Project Info + if: ${{ steps.template.outputs.template == 1 && inputs.library-name != null }} id: project-info shell: bash run: | if [ $ACTION = opened ]; then # we have to get the head sha directly from the pr api, because github silly ig echo "then" - sha=$(wget -O- --quiet https://api.github.com/repos/LemLib/LemLib/pulls/$PR_NUM | jq -r .head.sha | head -c 6) + sha=$(wget -O- --quiet https://api.github.com/repos/"${{inputs.repository}}"/pulls/$PR_NUM | jq -r .head.sha | head -c 6) else echo "else" sha=$(echo "$AFTER" | head -c 6) @@ -79,32 +76,51 @@ runs: POSTFIX: ${{ steps.project-info.outputs.postfix }} NAME: ${{ steps.project-info.outputs.name }} - #- name: Install ARM Toolchain - #uses: fiam/arm-none-eabi-gcc@v1 - #with: - #release: "10-2020-q4" - - #- name: Setup Python - #uses: actions/setup-python@v2 - #with: - #python-version: 3.9 - - #- name: PIP Installer - #uses: BSFishy/pip-action@v1 - #with: - #packages: pros-cli - - #- name: Testing PROS Install - #run: pros --version - #shell: bash - - #- name: Checkout - #uses: actions/checkout@v4 - #with: - #repository: ${{ inputs.repository }} - #path: ./pros-project - - #- name: Build PROS Project - #run: | - #make clean quick -j - #shell: bash + - name: Install ARM Toolchain + uses: fiam/arm-none-eabi-gcc@v1 + with: + release: "10-2020-q4" + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: PIP Installer + uses: BSFishy/pip-action@v1 + with: + packages: pros-cli + + - name: Testing PROS Install + run: pros --version + shell: bash + + - name: Build PROS Project + run: | + make clean quick -j + shell: bash + + - name: Prepare Template + if: ${{ steps.template.outputs.template == 1 && inputs.library-name != null }} + shell: bash + run: | + pros make template + mkdir -p template/include/lemlib/ + cp {LICENSE,README.md} template/include/"${{inputs.library-name}}"/ + echo "\n## [Github link](${{github.server_url}}/${{github.repository}})" >> template/include/"${{inputs.library-name}}"/README.md + perl -i -pe 's@(?<=[^/])(docs/assets/.*?)(?=[")])@${{github.server_url}}/${{github.repository}}/blob/master/$1?raw=true@g' template/include/"${{inputs.library-name}}"/README.md + echo $POSTFIX >> template/include/lemlib/VERSION + + - name: Unzip Template + if: ${{ steps.template.outputs.template == 1 && inputs.library-name != null }} + uses: montudor/action-zip@v1.0.0 + with: + args: unzip "${{steps.project-info.outputs.name}}.zip" -d template + + - name: Upload Artifact + if: ${{ steps.template.outputs.template == 1 && inputs.library-name != null }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.template-name.outputs.name }} + path: "template/*" + retention-days: 89