+
Skip to content

finebits/github-actions

Repository files navigation

github-actions

GitHub release License Check action YAML validation

Overview

Action badges/coverlet-coverage-badge

Summary

This creates test coverage badges from the coverlet.collector test report. Example badge: Shields.io badge

Using

  1. Test project:
  2. Github Gist:
    • Create secret gist;
    • Copy gist-id to new repository or organization variables (e.g., variable name GIST_ID).
  3. Personal access tokens:
    • Generate new token;
    • Add Gists permission;
    • Copy token value to new repository or organization secret (e.g., secret name TOKEN_GITHUB_GIST).
  4. Action badges/coverlet-coverage-badge can be added to the Github workflow:
- shell: bash
  run: |
    dotnet test ./source/test.csproj --collect:"XPlat Code Coverage" --results-directory="./source/TestResults"

- id: coverlet-coverage-badge
  uses: finebits/github-actions/badges/coverlet-coverage-badge@v3
  with:
    report-root: ./source/TestResults/**/
    report-filename: coverage.cobertura.xml
    gist-filename-format: "${{ github.event.repository.name }}-{0}-test-coverage.json"
    gist-id: ${{ vars.GIST_ID }}
    gist-auth-token: ${{ secrets.TOKEN_GITHUB_GIST }}

- shell: bash
  run: |
    json='${{ steps.coverlet-coverage-badge.outputs.badges-links }}'

    len=$(echo $json | jq '. | length')
    for ((i=0; i<$len; i++)); do
      echo -e "Badge link #"$i" $(echo $json | jq -r '.['$i']')\n"
    done

Action inputs

  • label - The badge label, default: "Test coverage"
  • package-label-format - The label format of the package badges, default: "{0}: test coverage"
  • label-color - Background color of the left part (hex, rgb, rgba, hsl, hsla and css named colors supported), default: grey
  • logo - One of the named logos supported by Shields
  • logo-svg - An SVG string containing a custom logo
  • logo-color - Supported for named logos and Shields logos
  • style - The default template to use, default: flat
  • gist-filename-format - The format name for the 'Github Gist' file that stores the badge's metadata, default: "{0}-test-coverage.json"
  • report-root - (required) Report root directory
  • report-filename - Report filename, default: "coverage.cobertura.xml"
  • gist-id - (required) The unique identifier of the 'Github Gist' where badge metadata is stored
  • gist-auth-token - (required) Authentication token to update the the 'Github Gist
  • gist-owner - 'Github Gist' owner, default: ${{ github.repository_owner }}

Action outputs

  • badges-links - contains a json array of markdown badges links

Action badges/shields-io-badge

Summary

This generates Shields.io endpoint badge. Example badge: Shields.io badge

Using

  1. Github Gist:
    • Create secret gist;
    • Copy gist-id to new repository or organization variables (e.g., variable name GIST_ID).
  2. Personal access tokens:
    • Generate new token;
    • Add Gists permission;
    • Copy token value to new repository or organization secret (e.g., secret name TOKEN_GITHUB_GIST).
  3. Action badges/shields-io-badge can be added to the Github workflow:
- id: shields-io-badge
  uses: finebits/github-actions/badges/shields-io-badge@v3
  with:
    label: shields.io
    label-color: lightblue
    message: badge
    message-color: gold
    logo: github
    logo-color: blue
    style: flat
    gist-filename: "shields-io-badge.json"
    gist-id: ${{ vars.GIST_ID }}
    gist-auth-token: ${{ secrets.TOKEN_GITHUB_GIST }}

- shell: bash
  run: |
    echo "Badge: ${{ steps.shields-io-badge.outputs.badge-link }}"

Action inputs

  • label - (required) The left side text of the badge, it might be empty
  • message - (required) The right side text, it can't be empty
  • label-color - Background color of the left part (hex, rgb, rgba, hsl, hsla and css named colors supported), default: grey
  • message-color - Background color of the right part (hex, rgb, rgba, hsl, hsla and css named colors supported), default: lightgrey
  • is-error - True to treat this as an error badge, default: false
  • logo - One of the named logos supported by Shields
  • logo-svg - An SVG string containing a custom logo
  • logo-color - Supported for named logos and Shields logos
  • logo-width - Logo width
  • logo-position - Logo position
  • style - The default template to use, default: flat
  • badge-description - gist file description
  • gist-filename - (required) The format name for the 'Github Gist' file that stores the badge's metadata
  • gist-id - (required) The unique identifier of the 'Github Gist' where badge metadata is stored
  • gist-auth-token - (required) Authentication token to update the the 'Github Gist'
  • gist-owner - 'Github Gist' owner, default: ${{ github.repository_owner }}

Action outputs

  • badge-link - markdown badge link

Action devhub/uno-platform/read-manifest

Summary

Read the Uno Platform setup manifest from the uno-check tool.

Using

Important

Prerequisites: .NET SDK (i.e., uses: actions/setup-dotnet)

- id: uno-check-manifest
  uses: finebits/github-actions/devhub/uno-platform/read-manifest@v3

- shell: bash
  run: |
    dotnet_version="${{ fromJSON(steps.uno-check-manifest.outputs.content).check.variables.DOTNET_SDK_VERSION }}"

Action inputs

  • uno-check-manifest - Specific manifest URL of the uno-check tool
  • uno-check-version - Specific version of the uno-check tool

Action outputs

  • content - Contents of the Uno Platform manifest file

Action devhub/uno-platform/setup

Summary

Sets up the Uno Platform and its dependencies.

Using

- uses: finebits/github-actions/devhub/uno-platform/setup@v3

Action inputs

  • uno-sdk-version - Specifies the version of the Uno.Sdk
  • uno-check-skip - Skips a checkup by name or ID as listed in uno-check list, default: xcode vswin vsmac windowshyperv edgewebview2 androidemulator dotnetnewunotemplates
  • uno-check-manifest - Specifies the manifest URL of the 'uno-check' tool
  • uno-check-version - Specifies the version of the 'uno-check' tool
  • default-dotnet-version - Specifies the version of dotnet to install by default, default: 8.x
  • dotnet-install-dir - Specifies the location of the dotnet. This allows you to ignore the pre-installed dotnet, default: ${{ github.workspace }}/.dotnet

Action outputs

Action has no outputs.

Action package/appimage/pack

Summary

This packages a desktop application as an AppImage that runs on common Linux-based operating systems such as RHEL, CentOS, Ubuntu, Fedora, Debian and etc.

Using

Important

This action can only be used on Linux (i.e., runs-on: ubuntu-latest).

jobs:
  appimage:
    runs-on: ubuntu-latest

Action package/appimage/pack can be used in the Github workflow:

- uses: finebits/github-actions/package/appimage/pack@v3
  with:
    package-runtime: x86_64
    package-app-dir: ./.publish/appimage-package/AppDir
    package-output-dir: ./publish/output/packages

Action inputs

  • package-app-dir - (required) Path to Package AppDir directory
  • package-runtime - The package runtime. It can take one of the values: [aarch64, armhf, i686, x86_64], default: x86_64
  • package-output-dir - Path to output directory, default: ./.output/

Action outputs

  • package - Path to file *.AppImage

Action package/appimage/setup-appimagetool

Summary

This setups appimagetool, its runtimes and static tools.

Using

Important

This action can only be used on Linux (i.e., runs-on: ubuntu-latest).

jobs:
  appimage:
    runs-on: ubuntu-latest

Action package/appimage/setup-appimagetool can be used in the Github workflow:

- uses: finebits/github-actions/package/appimage/setup-appimagetool@v3

Action inputs

Action has no inputs.

Action outputs

Action has no outputs.

Action package/nuget/pack

Summary

This packages the project into a NuGet package. Also pack-nuget action can:

  • sign the NuGet package
  • push to nuget.org and/or nuget.pkg.github.com
  • save the NuGet artifact to Github

Using

- uses: finebits/github-actions/package/nuget/pack@v3
  with:
    project: ./source/Hello.Nuget.csproj
    configuration: Release
    upload-artifact: true
    artifact-name: Hello.Nuget
    push-to-nuget: true
    nuget-apikey: ${{ secrets.NUGET_APIKEY }}
    push-to-github: true
    github-token: ${{ secrets.TOKEN_GITHUB_PACKAGE }}
    github-owner: ${{ github.repository_owner }}
    certificate: ${{ secrets.NUGET_BASE64_CERT }}
    certificate-password: ${{ secrets.NUGET_CERT_PASSWORD }}

Action inputs

  • project - (required) Project file for NuGet packaging
  • configuration - (required) Defines the build configuration
  • upload-artifact - The true value allows you to save the NuGet artifact, default: false
  • artifact-name - Defines the artifact file name, default: nuget
  • push-to-nuget - The true value allows you to push the nuget to nuget.org, default: false
  • nuget-apikey - The API key for nuget.org
  • push-to-github - The true value allows you to push the nuget to nuget.pkg.github.com, default: false
  • github-token - Github token (required write:packages scopes)
  • github-owner - Github package owner
  • certificate - Base64 encoded certificate
  • certificate-password - A password string
  • file-version - Redefines assembly version, default version calculated from git tag
  • package-version - Redefines the NuGet package version, default version calculated from git tag

Action outputs

  • artifact-full-name - final nuget artifact name

Action toolset/file/read

Summary

This reads the contents of a file and saves it in the output.

Using

Action toolset/file/read can read file in the Github workflow:

- id: read-config
  uses: finebits/github-actions/toolset/file/read@v3
  with:
    url: http://site.com/config.json
    file: config.json

- shell: bash
  run: |
    option="${{ fromJSON(steps.read-config.outputs.content).option }}"

where config.json:

{ 
  "option":"value"
}

Action inputs

  • url - Link to file.
  • file - Path to local file. This is used if the input url is empty or the http status is not OK(200).

Action outputs

  • content - file contents

Action toolset/file/replace-text

Summary

This replaces all occurrences of a placeholder with a given value string inside a file.

Using

- uses: finebits/github-actions/toolset/file/replace-text@v3
  with:
    file: ./source/hello.js
    find-what: <!placeholder>
    replace-with: "hello world"

Action inputs

  • file - (required) Path to source file
  • find-what - (required) Replacement text
  • replace-with - (required) Required text

Action outputs

Action has no outputs.

Action toolset/assign-version

Summary

This gets a version number using a git tag, a git commit, a Github workflow context.

Using

- id: version
  uses: finebits/github-actions/toolset/assign-version@v3

- shell: bash
  run: |
    echo "Current version: ${{ steps.version.outputs.preset-semantic-v1 }}"

Action inputs

Action has no inputs.

Action outputs

  • run-number - contains the run number of the workflow (look at github action context)
  • run-attempt - contains the re-run number of the workflow (look at github action context)
  • today - contains the date of the workflow execution in the format yyyymmdd
  • today-compact - contains the date of the workflow execution in the format yymmdd
  • commit-hash - contains the full SHA-1 hash of the latest commit in the current branch
  • commit-short-hash - contains the short SHA-1 hash of the latest commit in the current branch
  • total-commits - contains the number of commits for the current branch

If there is tag in the format v{major}[.{minor}[.{patch}]][-{suffix}] (e.g., v1.2-beta) then

  • major - contains the value of the major component of the version number, default value 1
  • minor - contains the value of the minor component of the version number, default value 0
  • patch - contains the value of the patch component of the version number, default value 0
  • suffix - contains the suffix version, it can be empty

Preset version formats:

  • preset-numeric - version format: {major}.{minor}.{patch}
  • preset-semantic-v1 - version format: {major}.{minor}.{patch}[-{suffix}]
  • preset-semantic-v2 - version format: {major}.{minor}.{patch}[-{suffix}]+{commit-hash}
  • preset-semantic-v2-extended - version format: {major}.{minor}.{patch}[-{suffix}]+{today}.{run-number}.{run-attempt}.{commit-hash}

Action toolset/github/upload-release-asset

Summary

It uploads an asset to the existing release. Also upload-release-asset action can upload several assets if the path contains a pattern.

Using

- uses: finebits/github-actions/toolset/github/upload-release-asset@v3
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    tag: ${{ github.event.release.tag_name }}
    path: "assets/*"

Action inputs

  • github-token - (required) The github token must have contents:write permission
  • path - (required) Path to asset file. This can be a pattern-path to several files
  • tag - The name of the tag. To use the latest release, leave the value unset. default: unset
  • github-api-version - To specify a version of the Github REST API, default: 2022-11-28
  • github-repository - The name of the repository (e.g., finebits/github-actions). The name is not case sensitive. default: ${GITHUB_REPOSITORY}

Action outputs

Action has no outputs.

Action toolset/select-configuration

Summary

This allows you to select configurations from JSON by keywords.

Using

The config.json file contains several configurations:

[
  {
    "keywords":["A","B"],
    "option":"value-a"
  },
  {
    "keywords":["A","C"],
    "option":"value-b"
  },
  {
    "keywords":["C","B"],
    "option":"value-c"
  }
]

Action toolset/select-configuration can select a configuration in the Github workflow:

- id: config
  uses: finebits/github-actions/toolset/select-configuration@v3
  with:
    json-file: config.json
    keywords: A B

- shell: bash
  run: |
    option="${{ fromJson(steps.config.outputs.config-json)[0].option }}"

Action toolset/select-configuration can be used as a source of strategy:

jobs:
  prepare:
    runs-on: 'ubuntu-latest'
    outputs:
      matrix: ${{ steps.config.outputs.matrix }}
    steps:
      - id: config
        uses: finebits/github-actions/toolset/select-configuration@v3
        with:
          json-file: config.json
          keywords: A

  process:
    needs: prepare
    strategy:
      matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}

Action inputs

  • json - JSON data. This should only be empty if the input json-file has path to JSON-file
  • json-file - Path to JSON file. This is ignored if the input json is not empty
  • keywords - (required) A set of keywords separated by the SPACE symbol
  • configs-set-jsonpath - JSON path to the configuration set, where "." is the JSON root, default: '.'
  • keywords-set-jsonpath - JSON path to a set of keys, where "." is the configuration root, default: '.keywords'
  • exclude-keywords - It excludes keywords from the output JSON configurations, default: true

Action outputs

  • config-json - output configuration array in JSON format
  • matrix - configurations prepared as a source of strategy
  • length - contains the number of suitable configurations
  • is-empty - true if no matching configuration exists

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载