Skip to content

Commit

Permalink
add new wfs
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenko-kovac committed Jun 26, 2023
1 parent 9b3e390 commit 1024933
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release

on:
workflow_dispatch:
inputs:
version-bump:
description: 'Whether to bump major, minor or patch version'
# For exmaple:
# Bump major version (i.e. current_version=v1.2.3 --> new_version=v2.0.0)'
# Bump minor version (i.e. current_version=v1.2.3 --> new_version=v1.3.0)
# Bump patch version (i.e. current_version=v1.2.3 --> new_version=v1.2.4)
required: false
default: patch
type: choice
options:
- major
- minor
- patch
desired-version:
description: 'Version to be released'
required: false
default: ''
ref:
description: 'The branch, tag, or SHA to release'
required: false
default: 'main'

defaults:
run:
shell: bash

env:
REGISTRY: ghcr.io

jobs:
release:
name: Create release
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.WORKFLOW_USER_GH_TOKEN }}

- name: Get latest tag
uses: actions-ecosystem/action-get-latest-tag@v1
if: inputs.desired-version == ''
id: get-latest-tag
with:
semver_only: true
initial_version: 'v0.0.0'

- name: Bump version
uses: actions-ecosystem/action-bump-semver@v1
if: inputs.desired-version == ''
id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ inputs.version-bump }}

- name: Prepare version
id: prepare_version
run: |
if "${{ inputs.desired-version != '' }}"
then
echo "version=${{ inputs.desired-version }}" >> $GITHUB_OUTPUT
else
echo "version=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_OUTPUT
fi
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.prepare_version.outputs.version }}
draft: false
prerelease: false
target_commitish: ${{ inputs.ref }}
token: ${{ secrets.WORKFLOW_USER_GH_TOKEN }}
generate_release_notes: true
57 changes: 57 additions & 0 deletions .github/workflows/update-content.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Update Content

on:
workflow_dispatch:
inputs:
version-bump:
description: 'Whether to bump major, minor or patch version'
# For exmaple:
# Bump major version (i.e. current_version=v1.2.3 --> new_version=v2.0.0)'
# Bump minor version (i.e. current_version=v1.2.3 --> new_version=v1.3.0)
# Bump patch version (i.e. current_version=v1.2.3 --> new_version=v1.2.4)
required: false
default: patch
type: choice
options:
- major
- minor
- patch

defaults:
run:
shell: bash

jobs:
update-content:
name: Update external resources used by this repository
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.WORKFLOW_USER_GH_TOKEN }}

- name: Update content
run: make update-content

- name: Commit changes
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git pull
git add -A
git commit -m "update external resources" || true //do not throw error, when nothing to commit
git push
- name: Create a workflow_dispatch event in clustersecret-operator-cop repo
run: |
curl --request POST \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${{ secrets.WORKFLOW_USER_GH_TOKEN }}" \
--url https://api.github.com/repos/sap/clustersecret-operator-cop/actions/workflows/release.yaml/dispatches \
--data '{
"ref":"main",
"inputs":{
"version-bump":"${{ github.event.inputs.version-bump }}"
}
}'

0 comments on commit 1024933

Please sign in to comment.