1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-22 06:02:51 +00:00
catalog/task/create-github-release/0.1
PuneetPunamiya ccd1080419 Modifies the path in readme for samples directory
Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
2020-07-15 02:43:58 +01:00
..
samples Modifies directory names based on the proposal 2020-07-14 19:01:58 +01:00
create-github-release.yaml This patch splits create-github-release task from the github directory 2020-07-13 13:41:58 +01:00
README.md Modifies the path in readme for samples directory 2020-07-15 02:43:58 +01:00

Create Github Release

It is typical to create a Github tag at the moment of release to introduce a checkpoint in your source code history, but in most cases users will need compiled objects or other assets output, not just the raw source code.

Github Releases are a way to track deliverables in your project. Consider them a snapshot in time of the source, build output, artifacts, and other metadata associated with a released version of your code.

This task can be used to make a github release.

Task can also be used to upload multiple assets including binaries of the released version and the release notes, with the release.

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/create-github-release/0.1/create-github-release.yaml

Parameters

  • TAG: A git tag name that will be created with this release (e.g:v1.0.0).
  • REVISION: A Git revision to create a release from (branch, tag, sha, ref…) (default:master).
  • RELEASE_FILE_NAME: Name of the file that has to be uploaded as release notes (default:release.md).
  • GITHUB_TOKEN_SECRET: The name of the secret holding the github-token (default:github-token).
  • GITHUB_TOKEN_SECRET_KEY: The name of the secret key holding the github-token (default:GITHUB_TOKEN).

Workspace

  • input: To mount asset which has to be uploaded with the release.
  • source: Contains Github repository on which release has to be made.
  • release-notes: To mount file that has to provided as release notes in the release.

Secrets

  • Secret to provide Github access token to authenticate to the Github.

Check this to get personal access token for Github.

Usage

This task expects a secret named github-token to exists, with a GitHub token in GITHUB_TOKEN with enough privileges to create a release.

This task can upload multiple assets with the release on the github, in order to do that any volume (supported in workspace) can be mounted in the workspace named input containing all the assets that needs to be uploaded.

Release Notes can also be uploaded with the release by mounting the the release notes file in the workspace named release-notes. Name of the release notes file should also be provided in the params, default is release.md.

Release can be created at a particular branch, tag or commit sha, to achieve that, required branch, tag or commit sha can be added in the param commitish.

Github repository on which release has to be performed must be available in the workspace named source. This can be done using git-clone task as shown here.

To make a release put all the required params, add required secrets and release will be done.

Secrets can be created as follows:

apiVersion: v1
kind: Secret
metadata:
  name: github-token
type: Opaque
stringData:
  GITHUB_TOKEN: $(personal_access_token)

This example uses ConfigMap for mounting asset file to the workspace, ConfigMap can be created as follows:

kubectl create configmap upload-asset --from-file=file1.txt --from-file=file2.txt 

Note

  • If case asset is not to be uploaded with the release, then emptyDir needs to be mounted in the workspace as shown below:

    workspaces:
      - name: input
        emptyDir: {}
    
    
  • Task uses image from quay.io/diagrawa/github-hub which is based on this Dockerfile.