From 469a08a6ea5b9d45930866ac1478d8caa6ce74de Mon Sep 17 00:00:00 2001 From: Yash Jain <46950318+yjpictures@users.noreply.github.com> Date: Sun, 5 Nov 2023 13:02:36 -0500 Subject: [PATCH] Create action (#1) Created an action script and a test workflow that runs on every push --- .github/actions/action.yml | 34 ++++++++++++++++++++ .github/workflows/test.yml | 65 ++++++++++++++++++++++++++++++++++++++ action.yml | 21 ------------ 3 files changed, 99 insertions(+), 21 deletions(-) create mode 100644 .github/actions/action.yml create mode 100644 .github/workflows/test.yml delete mode 100644 action.yml diff --git a/.github/actions/action.yml b/.github/actions/action.yml new file mode 100644 index 0000000..8836c48 --- /dev/null +++ b/.github/actions/action.yml @@ -0,0 +1,34 @@ +name: 'GTK for Windows' +author: 'Yash Jain' +description: 'This will add GTK+ in Windows Runtime Environment' + +runs: + + using: "composite" + + steps: + + - name: Message for Non-Windows Users + if: runner.os != 'Windows' + shell: bash + env: + THIS_OS: ${{ runner.os }} + run: echo "::warning title=GTK for Windows::GTK for Windows is not supported on any operating systems other than Windows. You are attempting to use it on $THIS_OS." + + + - name: Import GTK-for-Windows-Runtime-Environment-Installer + uses: actions/checkout@v4 + if: runner.os == 'Windows' + with: + repository: tschoonj/GTK-for-Windows-Runtime-Environment-Installer + path: _tempGTK + sparse-checkout: gtk-nsis-pack + sparse-checkout-cone-mode: false + clean: false + + - name: Add to ENV + if: runner.os == 'Windows' + shell: powershell + run: | + $Env:PATH += "$PWD\_tempGTK\gtk-nsis-pack\bin" + echo "$PWD\_tempGTK\gtk-nsis-pack\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0dbd29c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,65 @@ +name: Test GTK for Windows + +on: + push + +jobs: + + use-GTK: + + name: Use GTK to convert MD to PDF + strategy: + fail-fast: false + matrix: + os: [windows-2019, windows-2022] + runs-on: ${{ matrix.os }} + + steps: + + - name: Checkout the actions folder + uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions + sparse-checkout-cone-mode: false + + - name: Dowload mdPDFinator + uses: robinraju/release-downloader@v1.8 + with: + repository: yjpictures/mdPDFinator + latest: true + fileName: mdPDFinator-Windows.exe + + - name: Download sample markdown + run: curl ${{ vars.SAMPLE_MARKDOWN_URL }} -o sample.md + + - name: Add GTK + uses: ./.github/actions + + - name: Test it out + run: ./mdPDFinator-Windows sample.md -o output-${{ matrix.os }}.pdf + + - name: Upload the converted PDF file + uses: actions/upload-artifact@v3 + with: + name: test-output + path: output-${{ matrix.os }}.pdf + + use-GTK-non-supported: + + name: Test out non-supported OSs + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + + steps: + + - name: Checkout the actions folder + uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions + sparse-checkout-cone-mode: false + + - name: Add GTK + uses: ./.github/actions diff --git a/action.yml b/action.yml deleted file mode 100644 index 7f48d8d..0000000 --- a/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: 'Hello World' -description: 'Greet someone' -inputs: - who-to-greet: # id of input - description: 'Who to greet' - required: true - default: 'World' -outputs: - random-number: - description: "Random number" - value: ${{ steps.random-number-generator.outputs.random-number }} -runs: - using: "composite" - steps: - - run: echo Hello ${{ inputs.who-to-greet }}. - shell: bash - - id: random-number-generator - run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT - shell: bash - - run: echo "${{ github.action_path }}" >> $GITHUB_PATH - shell: bash