Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
60.8K

Create a GitHub release github-release

Create a GitHub release.

arguments

  • base_url - API endpoint (default: "https://api.github.com")
  • draft - `true` makes the release a draft, and `false` publishes the release
  • files - A list of files to be uploaded
  • git_context_name - Codefresh Git Context to be used by the plugin. Must be a github git context. If empty, it will try to get the context from the pipeline trigger
  • git_token - Git token to use for authentication to github. If empty, we will try to get the token from your Codefresh Git Context specified in `git_context_name`
  • prerelease - If true, this variable tells the plugin to create a pre-release
  • release_description - Release description
  • release_name - Name of the release
  • release_tag - Git tag to create a release
  • repo_name - Codefresh provided variable containing repository name
  • repo_owner - Codefresh provided variable containing repository owner name
    github_release:
  type: github-release
  title: Typical usage example
  description: |-
    The git_context_name, repo_owner and repo_name vars
    will be taken automatically from the trigger.
    Requires the pipeline to be started by a github trigger
  arguments:
    release_name: my-release
    release_tag: my-tag-0.1.0
    files:
      - '${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}/my-file1'
      - '${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}/my-file2'

  
    github_release:
  type: github-release
  title: Using git token example
  description: |-
    You can also pass a git token explicitly using the git_token
    argument. This is useful when you don't want to use a git-context
    or when the 'forbidDecrypt' feature turned on.
  arguments:
    git_token: '${{GITHUB_TOKEN}}'
    release_name: my-release
    release_tag: my-tag-0.1.0

  
    github_release:
  type: github-release
  title: Full example
  arguments:
    git_context_name: my-github-context
    release_name: my-release
    release_tag: my-tag-0.1.0
    release_description: My description
    draft: true
    prerelease: false
    repo_owner: some-owner
    repo_name: my-repo
    base_url: 'https://api.github.com'
    files:
      - '${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}/my-file1'
      - '${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}/my-file2'

  
    github_release:
  type: github-release
  title: A simplest example with minimum arguments provided
  description: |-
    Minimum arguments.
    The git_context_name, release_tag, repo_owner and repo_name vars
    will be taken from the trigger automatically.
    Requires the pipeline to be started by a github trigger
  arguments:
    release_name: my-release

  
    github_release:
  type: freestyle
  title: An example showing how to override the commands to be executed
  arguments:
    image: codefresh/github-release
    commands:
      - github-release --help
      - >-
        github-release list --token ${{MY_GITHUB_TOKEN}} --owner john-snow
        --repo night-watch

  
github.com
Codefresh
Nov 30, 2023