diff --git a/.changeset/kind-eggs-yawn.md b/.changeset/kind-eggs-yawn.md new file mode 100644 index 0000000000..8c5df1b62d --- /dev/null +++ b/.changeset/kind-eggs-yawn.md @@ -0,0 +1,10 @@ +--- +"@skeletonlabs/docs": patch +"@skeletonlabs/skeleton": patch +"@skeletonlabs/skeleton-common": patch +"@skeletonlabs/skeleton-react": patch +"@skeletonlabs/skeleton-svelte": patch +"skeleton": patch +--- + +This is a test release, identical to the previous version diff --git a/.github/scripts/release.sh b/.github/scripts/release.sh new file mode 100644 index 0000000000..8bf243932f --- /dev/null +++ b/.github/scripts/release.sh @@ -0,0 +1,68 @@ + +#!/usr/bin/env bash +set -euo pipefail + +BASE_SHA="${GITHUB_EVENT_BEFORE:?Missing GITHUB_EVENT_BEFORE}" +HEAD_SHA="${GITHUB_SHA:?Missing GITHUB_SHA}" + +PACKAGES="$(pnpm -r list --depth -1 --json)" + +while IFS= read -r package; do + NAME="$(jq -r '.name' <<< "$package")" + VERSION="$(jq -r '.version' <<< "$package")" + PATH_NAME="$(jq -r '.path' <<< "$package")" + PRIVATE="$(jq -r '.private // false' <<< "$package")" + + if [ "$PRIVATE" = "true" ]; then + continue + fi + + if ! git diff --quiet "$BASE_SHA" "$HEAD_SHA" -- "$PATH_NAME/package.json"; then + TAG="${NAME}@${VERSION}" + CHANGELOG="$PATH_NAME/CHANGELOG.md" + + if gh release view "$TAG" >/dev/null 2>&1; then + echo "Release already exists: $TAG" + continue + fi + + if [ ! -f "$CHANGELOG" ]; then + echo "Missing changelog for $NAME" + exit 1 + fi + + NOTES="$(mktemp)" + trap 'rm -f "$NOTES"' EXIT + + awk -v version="$VERSION" ' + $0 == "## " version { + found = 1 + print + next + } + + found && /^## / { + exit + } + + found { + print + } + ' "$CHANGELOG" > "$NOTES" + + if [ ! -s "$NOTES" ]; then + echo "Missing changelog entry for $TAG" + exit 1 + fi + + echo "Creating release: $TAG" + + gh release create "$TAG" \ + --target "$HEAD_SHA" \ + --title "$TAG" \ + --notes-file "$NOTES" + + rm "$NOTES" + trap - EXIT + fi +done < <(jq -c '.[]' <<< "$PACKAGES") diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index dedfb4d627..0c05868c64 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -30,6 +30,14 @@ jobs: run: pnpm install - name: Publish unpublished packages run: pnpm publish -r --access public --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create GitHub Releases + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_EVENT_BEFORE: ${{ github.event.before }} + GITHUB_SHA: ${{ github.sha }} + run: bash .github/scripts/release.sh - name: Create Release Pull Request env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}