Skip to content

Commit

Permalink
release: TRACEX-XXX create release 14.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-lcapellino committed Feb 18, 2025
1 parent 294bf7c commit 25e2429
Showing 1 changed file with 11 additions and 28 deletions.
39 changes: 11 additions & 28 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,84 +5,67 @@ on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'

env:
JAVA_VERSION: 17
# Specific CHANGELOG file which is used for releasing the product. Default <CHANGELOG.md>.
CHANGELOG_PATH: 'CHANGELOG.md'
HELM_CHANGELOG_PATH: 'charts/traceability-foss/CHANGELOG.md'
CHARTS_YAML_PATH: 'charts/traceability-foss/Chart.yaml'
CHARTS_YAML_FE_PATH: 'charts/traceability-foss/charts/frontend/Chart.yaml'

jobs:
release:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:

- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.TRACE_X_RELEASE_DOCUMENTATION_GH_APP_ID }}
private-key: ${{ secrets.TRACE_X_RELEASE_DOCUMENTATION_GH_APP_PRIVATE_KEY }}

- uses: actions/checkout@v4

- name: Calculate Helm release version from CHANGELOG
run: echo HELM_VERSION=$(cat ${{ env.HELM_CHANGELOG_PATH }} | sed -n 's/.*\[\([0-9]\+\.[0-9]\+\.[0-9]\+\)\].*/\1/p' | head -n 1) >> $GITHUB_ENV
run: echo HELM_VERSION=$(cat charts/traceability-foss/CHANGELOG.md | sed -n 's/.*\[\([0-9]\+\.[0-9]\+\.[0-9]\+\)\].*/\1/p' | head -n 1) >> $GITHUB_ENV

- name: Update Chart.yaml appVersion
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' ${{ env.CHARTS_YAML_PATH }}
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' charts/traceability-foss/Chart.yaml

- name: Update Chart.yaml version
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' ${{ env.CHARTS_YAML_PATH }}
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/Chart.yaml

- name: Update frontend dependency version in Chart.yaml
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.dependencies[0].version = "${{ env.HELM_VERSION }}"' ${{ env.CHARTS_YAML_PATH }}
cmd: yq -i eval '.dependencies[0].version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/Chart.yaml

- name: Update backend dependency version in Chart.yaml
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.dependencies[1].version = "${{ env.HELM_VERSION }}"' ${{ env.CHARTS_YAML_PATH }}
cmd: yq -i eval '.dependencies[1].version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/Chart.yaml

- name: Update frontend version in frontend/Chart.yaml
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' ${{ env.CHARTS_YAML_FE_PATH }}
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/charts/frontend/Chart.yaml

- name: Update frontend appVersion in frontend/Chart.yaml
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' ${{ env.CHARTS_YAML_FE_PATH }}
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' charts/traceability-foss/charts/frontend/Chart.yaml

- name: Update backend version in backend/Chart.yaml
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' ${{ env.CHARTS_YAML_FE_PATH }}
cmd: yq -i eval '.version = "${{ env.HELM_VERSION }}"' charts/traceability-foss/charts/backend/Chart.yaml

- name: Update backend appVersion in frontend/Chart.yaml
uses: mikefarah/[email protected]
with:
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' ${{ env.CHARTS_YAML_FE_PATH }}
cmd: yq -i eval '.appVersion = "${{ github.ref_name }}"' charts/traceability-foss/charts/backend/Chart.yaml

- name: Update the frontend package.json appVersion
run: |
sudo npm install -g json
sudo json -I -f frontend/package.json -e "this.version='${{ github.ref_name }}'"
- name: Prepare Helm release
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: "chore(release): Prepare release for Helm version ${{ env.HELM_VERSION }}"
branch: chore/prepare-helm-release-${{ env.HELM_VERSION }}
base: main
Expand All @@ -101,7 +84,7 @@ jobs:
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "CHANGELOG<<$EOF" >> $GITHUB_ENV
sed -n -e '/## \[${{ github.ref_name }}\]/,/## \[/ p' ${{ env.CHANGELOG_PATH }} | head -n -1 | tail -n +2 >> $GITHUB_ENV
sed -n -e '/## \[${{ github.ref_name }}\]/,/## \[/ p' CHANGELOG.md | head -n -1 | tail -n +2 >> $GITHUB_ENV
echo **Full Changelog**: ${{ github.server_url }}/${{ github.repository }}/compare/${{ env.PREVIOUS_VERSION }}...${{ github.ref_name }} >> $GITHUB_ENV
echo "$EOF" >> "$GITHUB_ENV"
Expand Down

0 comments on commit 25e2429

Please sign in to comment.