-
Notifications
You must be signed in to change notification settings - Fork 579
/
Copy pathcreate-github-release.yaml
78 lines (71 loc) · 2.42 KB
/
create-github-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: create-github-release
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: github
tekton.dev/displayName: "create github release"
spec:
description: >-
This `task` can be used to make a 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.
workspaces:
- name: input
- name: source
- name: release-notes
params:
- name: TAG
description: A git tag that will be created with this release (e.g. v1.0.0)
type: string
- name: REVISION
type: string
description: Git revision to create a release from (branch, tag, sha, ref…).
default: master
- name: RELEASE_FILE_NAME
type: string
description: Name of the file that has to be uploaded as release notes.
default: release.md
- name: GITHUB_TOKEN_SECRET
type: string
description: Name of the secret holding the github-token.
default: github-token
- name: GITHUB_TOKEN_SECRET_KEY
type: string
description: Name of the secret key holding the github-token.
default: GITHUB_TOKEN
steps:
- name: create-release
workingdir: $(workspaces.source.path)
image: quay.io/diagrawa/github-hub:latest
script: |
#!/usr/bin/env bash
set -ex
# Appending command to upload multiple release assets.
UPLOAD_ASSET=$(workspaces.input.path)/*
cmd=""
for file in $UPLOAD_ASSET
do
cmd="$cmd\
--attach $file"
done
# Create a release
echo "Creating release $(params.TAG)"
hub release create \
--commitish $(params.REVISION) \
--file $(workspaces.release-notes.path)/$(params.RELEASE_FILE_NAME) \
$cmd \
$(params.TAG)
env:
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: $(params.GITHUB_TOKEN_SECRET)
key: $(params.GITHUB_TOKEN_SECRET_KEY)