1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-22 06:02:51 +00:00
catalog/task/goreleaser/0.1
Vincent Demeester d93795673c Update self reference from master to main 🧙
And update references to community, pipeline, etc. too.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
2021-03-19 11:09:49 +00:00
..
samples Add GoReleaser task to Catalog 2020-09-30 11:52:52 +01:00
goreleaser.yaml Add GoReleaser task to Catalog 2020-09-30 11:52:52 +01:00
README.md Update self reference from master to main 🧙 2021-03-19 11:09:49 +00:00

GoReleaser

GoReleaser builds Go binaries for several platforms, creates a GitHub release and then pushes a Homebrew formula to a tap repository.

Installing the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/goreleaser/0.1/goreleaser.yaml

Parameters

  • package: Base package to build and release. (Required)
  • github-token-secret: Name of the secret holding the github-token. (Default: bot-token-github)
  • github-token-secret-key: Name of the secret key holding the github-token. (Default: bot-token)
  • flags: Flags to pass to goreleaser release. (Default: --timeout=30m)

Workspaces

  • source: The workspace containing the Go source code which needs to be released. The default mountPath is /workspace/src/$(params.package)

Usage

  1. Create the GitHub token by following the steps from here

  2. Create the Secret

kubectl create secret generic bot-token-github --from-literal=bot-token=${github_token}
  1. Create the Pipeline and PipelineRun
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: gorelease-pipeline
spec:
  workspaces:
    - name: shared-workspace
  params:
    - name: url
      description: git url to clone
    - name: revision
      description: revision branch to checkout
    - name: package
      description: package to release
      default: github.com/tektoncd/cli
    - name: github-token-secret
      description: name of the secret holding the github-token
      default: bot-token-github
    - name: github-token-secret-key
      description: name of the key for the secret holding the github-token
      default: bot-token
  tasks:
    - name: fetch-repository
      taskRef:
        name: git-clone
      workspaces:
        - name: output
          workspace: shared-workspace
      params:
        - name: url
          value: $(params.url)
        - name: revision
          value: $(params.revision)
        - name: deleteExisting
          value: "true"
    - name: release
      runAfter:
        - fetch-repository
      taskRef:
        name: goreleaser
      params:
        - name: package
          value: $(params.package)
        - name: github-token-secret
          value: $(params.github-token-secret)
        - name: github-token-secret-key
          value: $(params.github-token-secret-key)
      workspaces:
        - name: source
          workspace: shared-workspace
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  generateName: gorelease-pipeline-run
spec:
  pipelineRef:
    name: gorelease-pipeline
  workspaces:
    - name: shared-workspace
      volumeClaimTemplate:
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 500Mi
  params:
    - name: revision
      value: "v1.1.1"
    - name: url
      value: https://github.com/tektoncd/cli