Skip to content

Add typed outline modifier #232

Add typed outline modifier

Add typed outline modifier #232

Workflow file for this run

name: Publish Summon
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx2g -Dorg.gradle.vfs.watch=false"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Grant execute permissions
run: |
chmod +x gradlew
if [ -f sign-artifact.sh ]; then
chmod +x sign-artifact.sh
fi
- name: Set up Temurin JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle and build outputs
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/nodejs
~/.gradle/yarn
build
*/build
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts', '**/gradle.properties', 'gradle/libs.versions.toml') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Verify version matches tag
id: version
shell: bash
run: |
VERSION=$(grep "^VERSION=" version.properties | cut -d'=' -f2)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
TAG="${GITHUB_REF_NAME}"
if [[ "$TAG" != "v$VERSION" ]]; then
echo "::error::Tag $TAG does not match version v$VERSION from version.properties"
exit 1
fi
fi
- name: Run fast tests (parallelized)
run: |
# Clean JS test compilation to avoid cache corruption issues with K2
./gradlew --no-daemon :summon-core:cleanCompileTestKotlinJs || true
# Run fast tests with build cache and parallel execution
# Slow tests (stress/performance tests) are excluded and run separately in nightly builds
./gradlew --no-daemon --build-cache --max-workers=4 --console=plain \
:summon-core:jvmTest \
:summon-core:wasmJsTest \
:summon-cli:jvmTest \
--parallel --stacktrace
# JS tests without build cache to avoid restoring corrupted K2 artifacts
./gradlew --no-daemon --max-workers=4 --console=plain --no-build-cache :summon-core:jsTest --stacktrace
- name: Upload summon-cli jvmTest report
if: always()
uses: actions/upload-artifact@v4
with:
name: summon-cli-jvmTest-report
path: summon-cli/build/reports/tests/jvmTest
- name: Ensure tag does not already exist
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
if git ls-remote --tags origin "refs/tags/v${VERSION}" | grep -q .; then
echo "::error::Tag v${VERSION} already exists. Bump version.properties before releasing."
exit 1
fi
- name: Ensure publishing secrets are present
shell: bash
run: |
[[ -n "${{ secrets.CENTRAL_USERNAME }}" ]] || { echo "::error::Missing required secret CENTRAL_USERNAME"; exit 1; }
[[ -n "${{ secrets.CENTRAL_PASSWORD }}" ]] || { echo "::error::Missing required secret CENTRAL_PASSWORD"; exit 1; }
[[ -n "${{ secrets.CENTRAL_SIGNING_PASSWORD }}" ]] || { echo "::error::Missing required secret CENTRAL_SIGNING_PASSWORD"; exit 1; }
[[ -n "${{ secrets.CENTRAL_SIGNING_KEY_ASC }}" ]] || { echo "::error::Missing required secret CENTRAL_SIGNING_KEY_ASC"; exit 1; }
- name: Configure publishing credentials
shell: bash
run: |
cat <<'EOF' > local.properties
mavenCentralUsername=${{ secrets.CENTRAL_USERNAME }}
mavenCentralPassword=${{ secrets.CENTRAL_PASSWORD }}
signingPassword=${{ secrets.CENTRAL_SIGNING_PASSWORD }}
signingKey=provided-via-secret
EOF
SIGNING_SECRET="${{ secrets.CENTRAL_SIGNING_KEY_ASC }}"
if [[ -z "$SIGNING_SECRET" ]]; then
echo "::error::CENTRAL_SIGNING_KEY_ASC secret is not set"
exit 1
fi
if echo "$SIGNING_SECRET" | base64 -d > private-key.asc 2>/tmp/base64-decode.log; then
echo "Imported signing key from base64-encoded secret"
else
echo "$SIGNING_SECRET" > private-key.asc
echo "Stored signing key as literal ASCII-armored block"
fi
chmod 600 private-key.asc
# Validate the signing key is importable before proceeding (fail fast)
TMP_GNUPGHOME=$(mktemp -d)
export GNUPGHOME="$TMP_GNUPGHOME"
if ! gpg --batch --yes --import private-key.asc >/tmp/gpg-import.log 2>&1; then
echo "::error::Signing key could not be imported"
cat /tmp/gpg-import.log || true
rm -rf "$TMP_GNUPGHOME"
exit 1
fi
rm -rf "$TMP_GNUPGHOME"
- name: Publish Summon library to Maven Central (codes.yousef)
run: ./gradlew :summon-core:publishToCentralPortalManually --stacktrace --info
- name: Extract latest changelog entry
id: changelog
shell: bash
run: |
python <<'PY'
import itertools
with open("CHANGELOG.md", encoding="utf-8") as fh:
lines = fh.readlines()
section = []
capture = False
for line in lines:
if line.startswith("## ["):
if capture:
break
capture = True
continue
if capture:
section.append(line.rstrip("\n"))
notes = "\n".join(section).strip()
print(notes)
with open("release-notes.md", "w", encoding="utf-8") as out:
out.write(notes + "\n")
PY
NOTES=$(cat release-notes.md)
echo "notes<<EOF" >> "$GITHUB_OUTPUT"
echo "$NOTES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Create and push release tag
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${VERSION}" -m "Summon ${VERSION}"
git push origin "v${VERSION}"
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: Summon ${{ steps.version.outputs.version }}
body_path: release-notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build CLI
run: ./gradlew summon-cli:build -PskipWrapperTests=true
- name: Publish CLI to GitHub Packages
run: ./gradlew summon-cli:publishCliPublicationToGitHubPackagesRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}