Skip to content

Update README.md

Update README.md #10

##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
name: Update README.md
# This workflow calls script update_md.sh to update the docs/content/User/StepByStepGuide.md file
on:
workflow_dispatch:
workflow_call:
secrets:
GH_ACCESS_TOKEN:
description: "GitHub Access Token"
required: true
GH_ACCESS_GPG_KEY:
description: "GitHub Access GPG Key"
required: true
GH_ACCESS_PASSPHRASE:
description: "GitHub Access Passphrase"
required: true
inputs:
commit-changes:
description: "Commit updated README.md"
type: boolean
required: false
default: false
version:
description: "The version to set the app to during deploy/release"
type: string
required: false
outputs:
commit-hash:
description: "The commit hash for the updated README.md commit"
value: ${{ jobs.update.outputs.commit_hash }}
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
update:
outputs:
commit_hash: ${{ steps.commit-readme.outputs.commit_hash }}
runs-on: solo-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout Code for Push
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
- name: Install wget
run: |
sudo apt-get update
sudo apt-get install -y wget
- name: Setup Kind
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
install_only: true
node_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72
version: v0.21.0
kubectl_version: v1.28.6
verbosity: 3
wait: 120s
- name: Install gettext-base
id: gettext-base
run: |
sudo apt-get update
sudo apt-get install gettext-base
- name: Update docs/content/User/StepByStepGuide.md
run: |
set -xeo pipefail
npm install
npm run build
npm install -g @hashgraph/solo
npm link
echo "VERSION=${{ inputs.version }}"
[[ -n "${{ inputs.version }}" ]] && npm version ${{ inputs.version }} -f --no-git-tag-version
which solo
node -p -e "Boolean(process.stdout.isTTY)"
chmod 755 ./.github/workflows/script/update_md.sh
./.github/workflows/script/update_md.sh </dev/null | cat
set +x
- name: Check docs/content/User/StepByStepGuide.md Changes
id: check-readme-changes
run: |
CHANGES=$(git diff --stat)
echo "Changes: $CHANGES"
INSERTIONS=$(echo $CHANGES | grep -o -P '(?<=insertions\(\+\), )\d+')
echo "Insertions: $INSERTIONS"
DELETIONS=$(echo $CHANGES | grep -o '[0-9]\+' | tail -1)
echo "Deletions: $DELETIONS"
# Calculate total lines changed if INSERTIONS and DELETIONS are not empty
if [ -z "$INSERTIONS" ]; then
INSERTIONS=0
fi
if [ -z "$DELETIONS" ]; then
DELETIONS=0
fi
TOTAL_LINES_CHANGED=$(($INSERTIONS + $DELETIONS))
echo "Total README lines changed: $TOTAL_LINES_CHANGED"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
with:
gpg_private_key: ${{ secrets.GH_ACCESS_GPG_KEY }}
passphrase: ${{ secrets.GH_ACCESS_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit docs/content/User/StepByStepGuide.md Changes
id: commit-readme
if : ${{ github.event.inputs.dry-run-enabled != 'true' && !cancelled() && !failure() && inputs.commit-changes }}
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
with:
commit_message: "auto update docs/content/User/StepByStepGuide.md [skip ci]"
commit_options: '--no-verify --signoff'
add_options: '-u'
file_pattern: 'docs/content/User/StepByStepGuide.md'
commit_user_name: Swirlds Automation
commit_user_email: [email protected]
commit_author: Swirlds Automation <[email protected]>
env:
GITHUB_TOKEN: ${{secrets.GH_ACCESS_TOKEN}}