-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pramod Bindal <[email protected]> Add Release workflows Add Release workflows Signed-off-by: Pramod Bindal <[email protected]> Signed-off-by: Pramod Bindal <[email protected]> change stepAction version to tekton.dev/v1beta1 Signed-off-by: Pramod Bindal <[email protected]>
- Loading branch information
1 parent
0e5f607
commit 5223ccf
Showing
5 changed files
with
159 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Define the version you want to release' | ||
required: true | ||
default: '0.0.1' | ||
|
||
jobs: | ||
release: | ||
permissions: | ||
contents: write | ||
packages: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: stable | ||
- name: github-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
make RELEASE_VERSION=v${{github.event.inputs.version}} github-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Renders and copies documentation files into the informed RELEASE_DIR, the script search for | ||
# task templates on a specific glob expression. The templates are rendered using the actual | ||
# task name and documentation is searched for and copied over to the task release directory. | ||
# | ||
|
||
shopt -s inherit_errexit | ||
set -eu -o pipefail | ||
|
||
readonly RELEASE_DIR="${1:-}" | ||
|
||
# Print error message and exit non-successfully. | ||
panic() { | ||
echo "# ERROR: ${*}" | ||
exit 1 | ||
} | ||
|
||
# Extracts the filename only, without path or extension. | ||
extract_name() { | ||
declare filename=$(basename -- "${1}") | ||
declare extension="${filename##*.}" | ||
echo "${filename%.*}" | ||
} | ||
|
||
# Function to find the respective documentation for a given name, however, for s2i it only consider the | ||
## "task-s2i" part instead of the whole name. | ||
find_doc() { | ||
declare name="${1}" | ||
[[ "${name}" == "task-s2i"* ]] && | ||
name="task-s2i" | ||
find docs/ -name "${name}*.md" | ||
} | ||
|
||
# | ||
# Main | ||
# | ||
|
||
release() { | ||
# making sure the release directory exists, this script should only create releative | ||
# directories using it as root | ||
[[ ! -d "${RELEASE_DIR}" ]] && | ||
panic "Release dir is not found '${RELEASE_DIR}'!" | ||
|
||
# Release task templates | ||
# release_templates "task" "templates/task-*.yaml" "tasks" | ||
|
||
# Release StepAction templates | ||
release_templates "stepaction" "tekton/*.yaml" "stepactions" | ||
} | ||
|
||
release_templates() { | ||
local template_type=$1 | ||
local glob_expression=$2 | ||
local release_subdir=$3 | ||
|
||
# releasing all templates using the following glob expression | ||
for t in $(ls -1 ${glob_expression}); do | ||
declare name=$(extract_name ${t}) | ||
[[ -z "${name}" ]] && | ||
panic "Unable to extract name from '${t}'!" | ||
|
||
# local doc=$(find_doc ${name}) | ||
# [[ -z "${doc}" ]] && | ||
# panic "Unable to find documentation file for '${name}'!" | ||
|
||
local dir="${RELEASE_DIR}/${release_subdir}/${name}" | ||
[[ ! -d "${dir}" ]] && | ||
mkdir -p "${dir}" | ||
|
||
# rendering the helm template for the specific file, using the resource name for the | ||
# filename respectively | ||
echo "# Rendering '${name}' at '${dir}'..." | ||
cp $t ${dir}/${name}.yaml || | ||
panic "Unable to render '${t}'!" | ||
|
||
# finds the respective documentation file copying as "README.md", on the same | ||
# directory where the respective task is located | ||
# echo "# Copying '${name}' documentation file '${doc}'..." | ||
# cp -v -f ${doc} "${dir}/README.md" || | ||
# panic "Unable to copy '${doc}' into '${dir}'" | ||
done | ||
} | ||
|
||
release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: tekton.dev/v1alpha1 | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: StepAction | ||
metadata: | ||
name: cache-fetch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apiVersion: tekton.dev/v1alpha1 | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: StepAction | ||
metadata: | ||
name: cache-upload | ||
|