mirror of
https://github.com/Noooste/garage-ui.git
synced 2026-07-26 07:48:13 +00:00
feat(docs): add documentation generation command to Makefile
Signed-off-by: Noste <83548733+Noooste@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
|||||||
manifest-file: .release-please-manifest.json
|
manifest-file: .release-please-manifest.json
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
|
|
||||||
- name: Sync Chart.yaml appVersion
|
- name: Sync Chart.yaml appVersion on release PR
|
||||||
if: ${{ steps.rp.outputs.prs_created == 'true' }}
|
if: ${{ steps.rp.outputs.prs_created == 'true' }}
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
@@ -55,3 +55,57 @@ jobs:
|
|||||||
cd -
|
cd -
|
||||||
rm -rf "$workdir"
|
rm -rf "$workdir"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
- name: Cut chart patch when backend released without chart
|
||||||
|
if: ${{ steps.rp.outputs.releases_created == 'true' }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
BACKEND_RELEASED: ${{ steps.rp.outputs.release_created }}
|
||||||
|
CHART_RELEASED: ${{ steps.rp.outputs['helm/garage-ui--release_created'] }}
|
||||||
|
BACKEND_TAG: ${{ steps.rp.outputs.tag_name }}
|
||||||
|
BACKEND_VERSION: ${{ steps.rp.outputs.version }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ "$BACKEND_RELEASED" != "true" ] || [ "$CHART_RELEASED" = "true" ]; then
|
||||||
|
echo "Backend not released, or chart already released this cycle. Nothing to do."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
workdir=$(mktemp -d)
|
||||||
|
git clone \
|
||||||
|
"https://x-access-token:${GH_TOKEN}@github.com/${REPO}.git" "$workdir"
|
||||||
|
cd "$workdir"
|
||||||
|
git config user.email "garage-ui-release-bot[bot]@users.noreply.github.com"
|
||||||
|
git config user.name "garage-ui-release-bot[bot]"
|
||||||
|
|
||||||
|
chart_old=$(jq -r '."helm/garage-ui"' .release-please-manifest.json)
|
||||||
|
chart_new=$(echo "$chart_old" | awk -F. '{printf "%d.%d.%d", $1, $2, $3+1}')
|
||||||
|
chart_tag="garage-ui-chart-v${chart_new}"
|
||||||
|
|
||||||
|
jq --arg v "$chart_new" '."helm/garage-ui" = $v' \
|
||||||
|
.release-please-manifest.json > .release-please-manifest.json.tmp
|
||||||
|
mv .release-please-manifest.json.tmp .release-please-manifest.json
|
||||||
|
|
||||||
|
sed -i -E "s|^version:.*|version: ${chart_new}|" helm/garage-ui/Chart.yaml
|
||||||
|
sed -i -E "s|^appVersion:.*|appVersion: ${BACKEND_TAG}|" helm/garage-ui/Chart.yaml
|
||||||
|
|
||||||
|
today=$(date -u +%Y-%m-%d)
|
||||||
|
compare_url="https://github.com/${REPO}/compare/garage-ui-chart-v${chart_old}...${chart_tag}"
|
||||||
|
entry=$(printf '## [%s](%s) (%s)\n\n\n### Miscellaneous Chores\n\n* sync chart appVersion to %s\n' \
|
||||||
|
"$chart_new" "$compare_url" "$today" "$BACKEND_TAG")
|
||||||
|
awk -v entry="$entry" 'NR==1 && /^# Changelog/ { print; print ""; print entry; next } { print }' \
|
||||||
|
helm/garage-ui/CHANGELOG.md > helm/garage-ui/CHANGELOG.md.tmp
|
||||||
|
mv helm/garage-ui/CHANGELOG.md.tmp helm/garage-ui/CHANGELOG.md
|
||||||
|
|
||||||
|
git add .release-please-manifest.json helm/garage-ui/Chart.yaml helm/garage-ui/CHANGELOG.md
|
||||||
|
git commit -m "chore: bump chart to ${chart_new} for backend ${BACKEND_TAG}"
|
||||||
|
git push origin main
|
||||||
|
|
||||||
|
git tag "$chart_tag"
|
||||||
|
git push origin "$chart_tag"
|
||||||
|
|
||||||
|
gh release create "$chart_tag" \
|
||||||
|
--repo "$REPO" \
|
||||||
|
--title "$chart_tag" \
|
||||||
|
--notes "Chart patch synced to backend ${BACKEND_TAG}. No chart template changes."
|
||||||
|
|||||||
@@ -154,3 +154,9 @@ test-cover:
|
|||||||
## test-smoke: Run the docker compose smoke test (requires Docker + compose v2)
|
## test-smoke: Run the docker compose smoke test (requires Docker + compose v2)
|
||||||
test-smoke:
|
test-smoke:
|
||||||
cd backend && go test -tags=smoke -timeout 10m ./tests/smoke/...
|
cd backend && go test -tags=smoke -timeout 10m ./tests/smoke/...
|
||||||
|
|
||||||
|
docs:
|
||||||
|
@echo "Generating documentation..."
|
||||||
|
@mkdir -p docs
|
||||||
|
@echo "Documentation generated in the 'docs' directory."
|
||||||
|
swag init -g backend/cmd/garage-ui/main.go -o docs --parseDependency --parseInternal
|
||||||
Reference in New Issue
Block a user