concourse / github-release-resource

a resource for github releases
Apache License 2.0
56 stars 58 forks source link

GitHub Releases Resource

Fetches and creates versioned GitHub resources.

If you're seeing rate limits affecting you then please add a token to the source configuration. This will increase your number of allowed requests.

Source Configuration

Example

- name: gh-release
  type: github-release
  source:
    owner: concourse
    repository: concourse
    access_token: abcdef1234567890
- get: gh-release
- put: gh-release
  params:
    name: path/to/name/file
    tag: path/to/tag/file
    body: path/to/body/file
    globs:
    - paths/to/files/to/upload-*.tgz
    generate_release_notes: true

To get a specific version of a release:

- get: gh-release
  version: { tag: 'v0.0.1' }

To set a custom tag filter:

- name: gh-release
  type: github-release
  source:
    owner: concourse
    repository: concourse
    tag_filter: "version-(.*)"

Behavior

check: Check for released versions.

Lists releases, sorted either by their version or time, depending on the order_by source option.

When sorting by version, the version is extracted from the git tag using the tag_filter source option. Versions are compared using semver semantics if possible.

When sorting by time and a release is published, it uses the publication time, otherwise it uses the creation time.

The returned list contains an object of the following format for each release (with timestamp in the RFC3339 format):

{
    "id": "12345",
    "tag": "v1.2.3",
    "timestamp": "2006-01-02T15:04:05.999999999Z"
}

When check is given such an object as the version parameter, it returns releases from the specified version or time on. Otherwise it returns the release with the latest version or time.

in: Fetch assets from a release.

Fetches artifacts from the requested release.

Also creates the following files:

Parameters

out: Publish a release.

Given a name specified in name, a body specified in body, and the tag to use specified in tag, this creates a release on GitHub then uploads the files matching the patterns in globs to the release.

Parameters

Development

Prerequisites

Running the tests

The tests have been embedded with the Dockerfile; ensuring that the testing environment is consistent across any docker enabled platform. When the docker image builds, the test are run inside the docker container, on failure they will stop the build.

Run the tests with the following command:

docker build -t github-release-resource --target tests --build-arg base_image=concourse/resource-types-base-image-static:latest .

Contributing

Please make all pull requests to the master branch and ensure tests pass locally.