generated from kyma-project/template-repository
-
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.
- Loading branch information
1 parent
4bc0e92
commit 1662375
Showing
4 changed files
with
176 additions
and
0 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,43 @@ | ||
name: Create draft release (reusable) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
VERSION: | ||
required: true | ||
type: string | ||
description: The semantic version number. | ||
secrets: | ||
BOT_PAT: | ||
required: true | ||
description: The github personal access token of your bot. | ||
GH_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
create-draft-release: | ||
name: Create a draft release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Write changelog to file | ||
env: | ||
VERSION: ${{ inputs.VERSION }} | ||
# note: your repository needs to have this file. | ||
# running this script should result in the file named CHANGELOG.md. | ||
shell: bash | ||
run: | | ||
./hack/scripts/create_changelog.sh "${VERSION}" | ||
- name: Print out changelog | ||
run: cat CHANGELOG.md | ||
|
||
- name: Create the draft release | ||
env: | ||
VERSION: ${{ inputs.VERSION }} | ||
GH_TOKEN: ${{ secrets.BOT_PAT }} | ||
shell: bash | ||
run: | | ||
gh release create "${VERSION}" --draft --notes-file CHANGELOG.md |
45 changes: 45 additions & 0 deletions
45
.github/workflows/get-version-from-release-branch-reusable.yml
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,45 @@ | ||
name: Get version from release branch (reusable) | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
VERSION: | ||
description: "The semantic version x.y.z, e.g.: 1.7.4" | ||
value: ${{ jobs.create-version.outputs.VERSION }} | ||
|
||
jobs: | ||
create-version: | ||
name: generate version number | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.generate.outputs.VERSION }} | ||
|
||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Verify that the current is branch is a release branch | ||
shell: bash | ||
run: | | ||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
[[ $CURRENT_BRANCH =~ ^release-([0-9]+)\.([0-9]+)$ ]] || exit 1 | ||
echo "MAJOR=${BASH_REMATCH[1]}" >> $GITHUB_ENV | ||
echo "MINOR=${BASH_REMATCH[2]}" >> $GITHUB_ENV | ||
exit 0 | ||
- name: Generate version | ||
id: generate | ||
shell: bash | ||
env: | ||
MAJOR: ${{ env.MAJOR }} | ||
MINOR: ${{ env.MINOR }} | ||
run: | | ||
TAGS=$(git tag -l "$MAJOR.$MINOR.*") | ||
if [[ -z $TAGS ]]; then | ||
PATCH=0 | ||
else | ||
PATCH=$(( $(echo $TAGS | cut -d '.' -f 3 | sort -n | tail -n 1) + 1)) | ||
fi | ||
VERSION="${MAJOR}.${MINOR}.${PATCH:-0}" | ||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
exit 0 |
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,29 @@ | ||
name: Publish release | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
VERSION: | ||
required: true | ||
type: string | ||
description: The semantic version number. | ||
secrets: | ||
BOT_PAT: | ||
required: true | ||
description: The github personal access token of your bot. | ||
|
||
jobs: | ||
publish-release: | ||
name: Publish release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Publish | ||
env: | ||
VERSION: ${{ inputs.VERSION }} | ||
GH_TOKEN: ${{ secrets.BOT_PAT }} | ||
shell: bash | ||
run: | | ||
gh release edit "${VERSION}" --draft=false --latest |
59 changes: 59 additions & 0 deletions
59
.github/workflows/render-and-upload-manifests-reusbale.yml
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,59 @@ | ||
name: Render and upload manifests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
VERSION: | ||
required: true | ||
type: string | ||
description: The semantic version number. | ||
CR_FILE: | ||
type: string | ||
required: true | ||
description: The file name of the CR. | ||
CRD_FILE: | ||
type: string | ||
required: true | ||
description: The file name of the CRD. | ||
secrets: | ||
BOT_PAT: | ||
required: true | ||
description: The github personal access token of your bot. | ||
|
||
jobs: | ||
render-and-upload-manifests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Render CRD | ||
env: | ||
VERSION: ${{ inputs.VERSION }} | ||
CRD_FILE: ${{ inputs.CRD_FILE }} | ||
shell: bash | ||
run: ./hack/scripts/render_crd.sh "${VERSION}" "${CRD_FILE}" | ||
|
||
- name: Print out CR file | ||
env: | ||
CR_FILE: ${{ inputs.CR_FILE }} | ||
shell: bash | ||
run: cat "${CR_FILE}" | ||
|
||
- name: Print out CRD file | ||
env: | ||
CRD_FILE: ${{ inputs.CRD_FILE }} | ||
shell: bash | ||
run: cat "${CRD_FILE}" | ||
|
||
- name: Upload manifests | ||
env: | ||
VERSION: ${{ inputs.VERSION }} | ||
GH_TOKEN: ${{ secrets.BOT_PAT }} | ||
CRD_FILE: ${{ inputs.CRD_FILE }} | ||
CR_FILE: ${{ inputs.CR_FILE }} | ||
shell: bash | ||
run: | | ||
gh release upload "${VERSION}" "${CR_FILE}" | ||
gh release upload "${VERSION}" "${CRD_FILE}" |