Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .github/workflows/reusable-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,31 @@ jobs:
- run: npm ci
working-directory: site

- name: List the tags before
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPOSITORY: ${{ github.repository }}
run: gh api "repos/${REPOSITORY}/tags" --paginate --jq '.[].name' | sort > "${RUNNER_TEMP}/tags-before"

- name: Tag a new version and draft its entries
working-directory: site
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPOSITORY: ${{ github.repository }}
run: npm run sync:releases -- --cut "--repo=${REPOSITORY}"

- name: Publish a GitHub release for each new tag
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
gh api "repos/${REPOSITORY}/tags" --paginate --jq '.[].name' | sort > "${RUNNER_TEMP}/tags-after"
comm -13 "${RUNNER_TEMP}/tags-before" "${RUNNER_TEMP}/tags-after" | while read -r tag; do
gh release create "$tag" --repo "$REPOSITORY" --verify-tag --generate-notes --title "$tag"
echo "Published the ${tag} release."
done

- run: node scripts/compile.mjs
working-directory: site

Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/reusable-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,32 +59,34 @@ jobs:
echo "slug=${SLUG}" >> "$GITHUB_OUTPUT"
echo "kind=${kind}" >> "$GITHUB_OUTPUT"

- name: Record tags
- name: Record the image tag
if: ${{ steps.entry.outputs.kind == 'compose' || steps.entry.outputs.kind == 'pages' }}
env:
SERVICES: ${{ inputs.services }}
TAG: ${{ inputs.tag }}
SLUG: ${{ steps.entry.outputs.slug }}
run: |
set -euo pipefail
export TAG="${TAG:-sha-${GITHUB_SHA::7}}"

if [ ! -d "deploy/${SLUG}" ]; then
echo "No deploy/${SLUG}/ in the platform repository, so ${SLUG} is not deployed; nothing to record."
exit 0
fi

python3 - <<'PY'
import json, os, pathlib
import os, pathlib

path = pathlib.Path("tags") / f"{os.environ['SLUG']}.json"
path.parent.mkdir(exist_ok=True)
tags = json.loads(path.read_text()) if path.exists() else {}
tags.update(dict.fromkeys(json.loads(os.environ["SERVICES"]), os.environ["TAG"]))
path.write_text(json.dumps(tags, indent=2, sort_keys=True) + "\n")
path = pathlib.Path("deploy") / os.environ["SLUG"] / "values"
lines = [line for line in (path.read_text().splitlines() if path.exists() else []) if not line.startswith("IMAGE_TAG=")]
path.write_text("\n".join([f"IMAGE_TAG={os.environ['TAG']}", *lines]) + "\n")
PY

git config user.name "graphite-deploy"
git config user.email "deploy@project-graphite.com"
git add "tags/${SLUG}.json"
git add "deploy/${SLUG}/values"

if git diff --cached --quiet; then
echo "Tags already at ${TAG}; nothing to record."
echo "IMAGE_TAG is already ${TAG}; nothing to record."
exit 0
fi

Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/reusable-sync-registry.yml

This file was deleted.

Loading