diff --git a/.github/actions/badge/action.yml b/.github/actions/badge/action.yml index 1e0384c8c..533fc91f0 100644 --- a/.github/actions/badge/action.yml +++ b/.github/actions/badge/action.yml @@ -1,5 +1,5 @@ -name: Make a Badge -description: Creates a JSON file for use with Sheilds.io. The default is a "brightgreen" "Passing" badge +name: Regular badging sequence +description: Publishes a badge based on the job status inputs: category: description: The subfolder where to group the badges @@ -7,18 +7,26 @@ inputs: label: description: The label to you in the badge (this should be unqie for each badge in a category) required: true - message: - description: The message you wish to have in the badge + github_token: + description: The token to use to publish the changes required: false - default: "Passing" - color: - description: The color you wish the badge to be - required: false - default: "brightgreen" + default: ${{ github.token }} runs: using: composite steps: - - run: | - mkdir -p badges/${{ inputs.category }}/${{ inputs.label }} - echo '{ "schemaVersion": 1, "label": "${{ inputs.label }}", "message": "${{ inputs.message }}", "color": "${{ inputs.color }}" }' > badges/${{ inputs.category }}/${{ inputs.label }}/shields.json - shell: bash + - if: success() + uses: ./.github/actions/badge/write + with: + category: ${{ inputs.category }} + label: ${{ inputs.label }} + - if: | + !success() + uses: ./.github/actions/badge/write + with: + category: ${{ inputs.category }} + label: ${{ inputs.label }} + message: Failing + color: red + - uses: ./.github/actions/badge/publish + with: + github_token: ${{ inputs.github_token }} diff --git a/.github/actions/badge/failure/action.yml b/.github/actions/badge/failure/action.yml deleted file mode 100644 index 78482dfce..000000000 --- a/.github/actions/badge/failure/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Make a Failure Badge -description: Publishes a badge indicating a 'Failing' status -inputs: - category: - description: The subfolder where to group the badges - required: true - label: - description: The label to you in the badge (this should be unqie for each badge in a category) - required: true - github_token: - description: The token to use to publish the changes - required: true -runs: - using: composite - steps: - - uses: ./.github/actions/badge - with: - category: ${{ inputs.category }} - label: ${{ inputs.label }} - message: Failing - color: red - - uses: ./.github/actions/badge/publish - with: - github_token: ${{ inputs.GITHUB_TOKEN }} diff --git a/.github/actions/badge/publish/action.yml b/.github/actions/badge/publish/action.yml index fab2fd6b3..0fcd3d6ce 100644 --- a/.github/actions/badge/publish/action.yml +++ b/.github/actions/badge/publish/action.yml @@ -3,13 +3,14 @@ description: Publishes all badges inputs: github_token: description: The token to use to publish the changes - required: true + required: false + default: ${{ github.token }} runs: using: composite steps: - uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ inputs.GITHUB_TOKEN }} + github_token: ${{ inputs.github_token }} publish_branch: badges publish_dir: ./badges keep_files: true diff --git a/.github/actions/badge/success/action.yml b/.github/actions/badge/success/action.yml deleted file mode 100644 index 2a724edb7..000000000 --- a/.github/actions/badge/success/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Make a Success Badge -description: Publishes a badge indicating a successful 'Passing' status -inputs: - category: - description: The subfolder where to group the badges - required: true - label: - description: The label to you in the badge (this should be unqie for each badge in a category) - required: true - github_token: - description: The token to use to publish the changes - required: true -runs: - using: composite - steps: - - uses: ./.github/actions/badge - with: - category: ${{ inputs.category }} - label: ${{ inputs.label }} - - uses: ./.github/actions/badge/publish - with: - github_token: ${{ inputs.GITHUB_TOKEN }} diff --git a/.github/actions/badge/write/action.yml b/.github/actions/badge/write/action.yml new file mode 100644 index 000000000..1e0384c8c --- /dev/null +++ b/.github/actions/badge/write/action.yml @@ -0,0 +1,24 @@ +name: Make a Badge +description: Creates a JSON file for use with Sheilds.io. The default is a "brightgreen" "Passing" badge +inputs: + category: + description: The subfolder where to group the badges + required: true + label: + description: The label to you in the badge (this should be unqie for each badge in a category) + required: true + message: + description: The message you wish to have in the badge + required: false + default: "Passing" + color: + description: The color you wish the badge to be + required: false + default: "brightgreen" +runs: + using: composite + steps: + - run: | + mkdir -p badges/${{ inputs.category }}/${{ inputs.label }} + echo '{ "schemaVersion": 1, "label": "${{ inputs.label }}", "message": "${{ inputs.message }}", "color": "${{ inputs.color }}" }' > badges/${{ inputs.category }}/${{ inputs.label }}/shields.json + shell: bash diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index ec8f72aae..57d79b7a2 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -20,21 +20,21 @@ jobs: run: cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/ - uses: actions/checkout@v2 - - run: cmake -E make_directory ${{github.workspace}}/build + - run: cmake -E make_directory ${{ github.workspace }}/build - name: configure shell: bash # access regardless of the host operating system - working-directory: ${{github.workspace}}/build + working-directory: ${{ github.workspace }}/build run: cmake $GITHUB_WORKSPACE -DJWT_BUILD_EXAMPLES=ON - name: build - working-directory: ${{github.workspace}}/build + working-directory: ${{ github.workspace }}/build shell: bash run: cmake --build . - if: matrix.os != 'windows-latest' name: test - working-directory: ${{github.workspace}}/build + working-directory: ${{ github.workspace }}/build shell: bash run: | ./example/rsa-create @@ -42,23 +42,13 @@ jobs: - if: matrix.os == 'windows-latest' name: test - working-directory: ${{github.workspace}}/build + working-directory: ${{ github.workspace }}/build run: | example\Debug\rsa-create.exe example\Debug\rsa-verify.exe - - name: badge success - if: github.event_name == 'push' && success() - uses: ./.github/actions/badge/success + - if: github.event_name == 'push' && always() + uses: ./.github/actions/badge with: category: cross-platform label: ${{ matrix.os }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: badge failure - if: github.event_name == 'push' && !success() - uses: ./.github/actions/badge/failure - with: - category: cross-platform - label: ${{ matrix.os }} - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ssl.yml b/.github/workflows/ssl.yml index c9ff72f71..2a76eb047 100644 --- a/.github/workflows/ssl.yml +++ b/.github/workflows/ssl.yml @@ -31,21 +31,11 @@ jobs: - name: test run: ./tests/jwt-cpp-test - - name: badge success - if: github.event_name == 'push' && success() - uses: ./.github/actions/badge/success + - if: github.event_name == 'push' && always() + uses: ./.github/actions/badge with: category: openssl label: ${{ matrix.openssl.name }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: badge failure - if: github.event_name == 'push' && !success() - uses: ./.github/actions/badge/failure - with: - category: openssl - label: ${{ matrix.openssl.name }} - github_token: ${{ secrets.GITHUB_TOKEN }} openssl-no-deprecated: runs-on: ubuntu-latest @@ -82,21 +72,11 @@ jobs: - name: test run: ./tests/jwt-cpp-test - - name: badge success - if: github.event_name == 'push' && success() - uses: ./.github/actions/badge/success - with: - category: libressl - label: ${{ matrix.libressl }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: badge failure - if: github.event_name == 'push' && !success() - uses: ./.github/actions/badge/failure + - if: github.event_name == 'push' && always() + uses: ./.github/actions/badge with: category: libressl label: ${{ matrix.libressl }} - github_token: ${{ secrets.GITHUB_TOKEN }} wolfssl: runs-on: ubuntu-latest @@ -119,18 +99,8 @@ jobs: - name: test run: ./tests/jwt-cpp-test - - name: badge success - if: github.event_name == 'push' && success() - uses: ./.github/actions/badge/success - with: - category: wolfssl - label: ${{ matrix.wolfssl.name }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: badge failure - if: github.event_name == 'push' && !success() - uses: ./.github/actions/badge/failure + - if: github.event_name == 'push' && always() + uses: ./.github/actions/badge with: category: wolfssl label: ${{ matrix.wolfssl.name }} - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/traits.yml b/.github/workflows/traits.yml index b97623db4..2647213d0 100644 --- a/.github/workflows/traits.yml +++ b/.github/workflows/traits.yml @@ -61,21 +61,21 @@ jobs: - name: badge success if: github.event_name == 'push' && success() - uses: ./.github/actions/badge + uses: ./.github/actions/badge/write with: category: traits label: ${{ matrix.target.name }} message: ${{ matrix.target.version }} color: lightblue # turquoise - - if: github.event_name == 'push' && success() - uses: ./.github/actions/badge/publish - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - name: badge failure if: github.event_name == 'push' && !success() - uses: ./.github/actions/badge/failure + uses: ./.github/actions/badge/write with: category: traits label: ${{ matrix.target.name }} + message: ${{ matrix.target.version }} + color: orange + - if: github.event_name == 'push' && always() + uses: ./.github/actions/badge/publish + with: github_token: ${{ secrets.GITHUB_TOKEN }}