Skip to content

Docs auto update #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/published_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,50 @@ jobs:
artifactName: homebrew-formula
artifactPath: .

prepare-documentation-update:
runs-on: ubuntu-latest
needs: [process-release-information,update-releases-yaml]
if: endsWith(github.event.client_payload.tagName, '.0')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this also include prereleases? Do we want to include them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by prereleases?

steps:
- name: Install ytt
uses: carvel-dev/setup-action@v1
with:
only: ytt
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout website
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: 'github.com/carvel-dev/carvel'
path: website
- name: Run documentation update
run: |
pushd website/site
docVersion=`echo ${{ github.event.client_payload.tagName }} | awk -F. '{print $1"."$2".x"}'`
./hack/release-doc.sh ${{ github.event.client_payload.toolName }} ${docVersion}
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

AUTHOR_EMAIL='[email protected]'
AUTHOR_NAME='carvel-bot'
MESSAGE="chore: auto-update documentation for ${{ github.event.client_payload.toolName }} ${docVersion} ${timestamp}"

remote_repo="[email protected]:${REPOSITORY}"

tempkey=`basename $0`
TMP_DEPLOY_PRIV_KEY=`mktemp /tmp/${tempkey}.XXXXXX` || exit 1
echo "${{ secrets.INSTALL_SH_DEPLOY_PRIVATE_KEY }}" > $TMP_DEPLOY_PRIV_KEY
eval $(ssh-agent -s)
ssh-add ${TMP_DEPLOY_PRIV_KEY}

git config http.sslVerify true
git config --local user.email "${AUTHOR_EMAIL}"
git config --local user.name "${AUTHOR_NAME}"

git add -A

git commit -m "${MESSAGE}" $_EMPTY || exit 0

git push "${remote_repo}" HEAD:develop --follow-tags;
prepare-releases-file-for-install-sh:
runs-on: ubuntu-latest
needs: process-release-information
Expand Down
19 changes: 17 additions & 2 deletions scripts/install_sh/install.sh.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ if test -z "$BASH_VERSION"; then
exit 1
fi

# Function to check for required commands
check_command() {
command -v "$1" >/dev/null 2>&1 || { echo >&2 "Error: $1 is required but not installed."; exit 1; }
}

# Check for required commands
check_command sha256sum || check_command sha1sum

# Set checksum command based on availability
CHECKSUM_CMD=sha256sum
if ! command -v $CHECKSUM_CMD >/dev/null 2>&1; then
CHECKSUM_CMD=sha1sum
fi

install() {
set -euo pipefail

Expand All @@ -17,10 +31,11 @@ install() {
if [ -x "$(command -v wget)" ]; then
dl_bin="wget -nv -O-"
else
check_command curl
dl_bin="curl -s -L"
fi

shasum -v 1>/dev/null 2>&1 || (echo "Missing shasum binary" && exit 1)
$CHECKSUM_CMD -v 1>/dev/null 2>&1 || (echo "Missing shasum binary" && exit 1)

if [[ `uname` == Darwin ]]; then
binary_type=darwin-amd64
Expand All @@ -37,7 +52,7 @@ install() {
(@ for val in data.values.products: @)
echo "Installing (@= val.product @)..."
$dl_bin (@= addProtocol(val.github.url) @)/releases/download/(@= val.version @)/(@= val.product @)-${binary_type} > /tmp/(@= val.product @)
echo "${(@= val.product @)_checksum} /tmp/(@= val.product @)" | shasum -c -
echo "${(@= val.product @)_checksum} /tmp/(@= val.product @)" | $CHECKSUM_CMD -c -
mv /tmp/(@= val.product @) ${dst_dir}/(@= val.product @)
chmod +x ${dst_dir}/(@= val.product @)
echo "Installed ${dst_dir}/(@= val.product @) (@= val.version @)"
Expand Down
Loading