Skip to content

Commit

Permalink
ci: add example release logic (#1008)
Browse files Browse the repository at this point in the history
Co-authored-by: Moritz Wiesinger <[email protected]>
  • Loading branch information
aepfli and mowies authored Mar 23, 2023
1 parent 502189a commit 3c96a02
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release Examples

on:
workflow_call:
inputs:
tag_name:
description: "Tag for the release being created"
type: "string"
required: true
examples_dir:
description: "Root directory of the examples"
type: "string"
required: false
default: "./tmp/examples/"
dry_run:
description: "Flag for testing"
type: "boolean"
default: false
required: false

jobs:
release-examples:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout examples repo
uses: actions/checkout@v3
with:
repository: keptn-sandbox/lifecycle-toolkit-examples
path: ${{ inputs.examples_dir }}
token: ${{ secrets.KEPTN_BOT_TOKEN }}

- name: Get Latest Release Information
uses: octokit/[email protected]
id: latest_release
with:
route: GET /repos/:owner/:repository/releases/latest
repository: lifecycle-toolkit
owner: keptn
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Move old latest release examples folder
if: ${{ fromJson(steps.latest_release.outputs.data).tag_name == inputs.tag_name }}
run: cp -R ./examples/* "${{ inputs.examples_dir }}"

- name: Push content
if: inputs.dry_run != true
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
cwd: ${{ inputs.examples_dir }}
message: "feat: release examples ${{ inputs.tag_name }}"
tag: "${{ inputs.tag_name }}"
10 changes: 10 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,13 @@ jobs:
tag_name: ${{ needs.release-please.outputs.tag_name }}
uses: ./.github/workflows/release-docs.yml
secrets: inherit

update-examples:
name: Update examples
needs:
- release-please
if: needs.release-please.outputs.releases_created == 'true'
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
uses: ./.github/workflows/release-examples.yml
secrets: inherit

0 comments on commit 3c96a02

Please sign in to comment.