Skip to content

Check tag

Check tag #594

Workflow file for this run

---
name: Check tag
on:
push:
branches:
- "release/*"
workflow_dispatch:
inputs:
branch:
description: Release branch
required: true
type: string
concurrency:
group: check-tag
cancel-in-progress: true
jobs:
check-tags:
name: Check tags
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check-tags.outputs.result }}
steps:
- name: Set envs
run: |
branch=${{ inputs.branch }} && [[ -z "$branch" ]] && branch=${{ github.event.ref }}
echo "tag=$(echo $branch | awk -F '/' '{print $NF}')" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: release/${{ env.tag }}
- name: Check tags in images
id: check-tags
run: |
images=$(grep -ro * -e "ghcr\.io\/networkservicemesh\/.*")
for image in $images; do
if [[ "$image" != *"${{ env.tag }}"* ]]; then
echo "result=0" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "result=1" >> "$GITHUB_OUTPUT"
replace-params:
name: Replace params
runs-on: ubuntu-latest
needs: check-tags
if: ${{ needs.check-tags.outputs.result == 0 }}
steps:
- name: Set envs
run: |
branch=${{ inputs.branch }} && [[ -z "$branch" ]] && branch=${{ github.event.ref }}
echo "tag=$(echo $branch | awk -F '/' '{print $NF}')" >> $GITHUB_ENV
git config --global user.email "nsmbot@networkservicmesh.io"
git config --global user.name "NSMBot"
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: release/${{ env.tag }}
- name: Replace image versions in apps folder
run: |
grep 'ghcr\.io\/networkservicemesh\/ci\/.*' -rl * | xargs sed -i "/ghcr\.io\/networkservicemesh\/ci/ s#ci\/\(.*\):.*#\1:${{ env.tag }}#g"
git add -- .
git commit -sm "Update image versions"
- name: Replace logging level with INFO
run: |
grep 'NSM_LOG_LEVEL' -rl * | xargs sed -i '/name: NSM_LOG_LEVEL/{ n; s/value: .*/value: INFO/g }'
grep 'NSM_LOG_LEVEL' -rl * | xargs sed -i 's/NSM_LOG_LEVEL: .*/NSM_LOG_LEVEL: INFO/g'
grep 'NSM_LOG_LEVEL' -rl * | xargs sed -i 's/NSM_LOG_LEVEL=TRACE/NSM_LOG_LEVEL=INFO/g'
git add -- .
git commit -s -m "Replace logging level with INFO"
- name: Replace pprof enabled value with false
run: |
grep 'NSM_PPROF_ENABLED' -rl * | xargs sed -i '/name: NSM_PPROF_ENABLED/{ n; s/value: .*/value: "false"/g }'
grep 'NSM_PPROF_ENABLED' -rl * | xargs sed -i 's/NSM_PPROF_ENABLED: .*/NSM_PPROF_ENABLED: "false"/g'
grep 'NSM_PPROF_ENABLED' -rl * | xargs sed -i 's/NSM_PPROF_ENABLED=true/NSM_PPROF_ENABLED=false/g'
git add -- .
git commit -s -m "Replace pprof enabled value with false"
- name: Update references to the latest tag
run: |
grep '?ref=' -rl * | xargs sed -i "/github.com\/networkservicemesh\/deployments-k8s/ s/\?ref=[a-z0-9]*/\?ref=${{ env.tag }}/g"
grep 'raw.githubusercontent.com' -rl * | xargs sed -i "/raw.githubusercontent.com\/networkservicemesh\/deployments-k8s/ s/deployments-k8s\/[a-z0-9]*/deployments-k8s\/${{ env.tag }}/g"
git add -- .
git commit -s -m "Update references"
git push origin release/${{ env.tag }}