Update mikefarah/yq action to v4.44.5 #243
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
name: Create a draft release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
draft-release: | |
if: github.repository_owner == 'telekom-mms' # do not run this elsewhere | |
permissions: | |
contents: write | |
issues: read | |
pull-requests: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Get Previous tag | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0 | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Calculate next version | |
id: version | |
uses: patrickjahns/version-drafter-action@2076fa43abb28f31d0e8b0890253fbd1d1a966fc # v1.3.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate changelog | |
uses: heinrichreimer/action-github-changelog-generator@e60b5a2bd9fcd88dadf6345ff8327863fb8b490f # v2.4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
futureRelease: ${{ steps.version.outputs.next-version }} | |
- name: Update YAML File with next version | |
uses: mikefarah/yq@bc5b54cb1d1f720db16c9f75c5b45384d00e5cbf # v4.44.5 | |
with: | |
cmd: | | |
yq e '.operator.trivyDojoReportOperator.image.tag = "${{ steps.version.outputs.next-version }}"' -i charts/values.yaml | |
yq e '.appVersion = "${{ steps.version.outputs.next-version }}"' -i charts/Chart.yaml | |
yq e '.version = "${{ steps.version.outputs.next-version }}"' -i charts/Chart.yaml | |
- name: Generate manifests from helm chart | |
run: helm template telekom-mms charts --values charts/values.yaml > deploy/trivy-dojo-report-operator.yaml | |
- name: Push Updates to YAML Files with next version | |
uses: github-actions-x/commit@722d56b8968bf00ced78407bbe2ead81062d8baa # v2.9 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push-branch: main | |
commit-message: Update version to ${{ steps.version.outputs.next-version }} | |
force-add: 'true' | |
files: charts/values.yaml charts/Chart.yaml CHANGELOG.md deploy/trivy-dojo-report-operator.yaml | |
name: Deutsche Telekom MMS | |
email: [email protected] | |
# do a second checkout to prevent race situation | |
# changelog gets updated but action works on old commit id | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: main | |
- name: Generate changelog for the release | |
run: | | |
sed '/## \[${{ steps.previoustag.outputs.tag }}\]/Q' CHANGELOG.md > CHANGELOGRELEASE.md | |
- name: Read CHANGELOG.md | |
id: package | |
uses: juliangruber/read-file-action@b549046febe0fe86f8cb4f93c24e284433f9ab58 # v1 | |
with: | |
path: ./CHANGELOGRELEASE.md | |
- name: Create Release draft | |
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
release_name: ${{ steps.version.outputs.next-version }} | |
tag_name: ${{ steps.version.outputs.next-version }} | |
body: | | |
${{ steps.package.outputs.content }} | |
draft: true |