changes actions to composite because packages are only private which is stupid and inane and shouldn't be that way like what the actual hell why can't they just make things logical
All checks were successful
Build and Push Deno Release Action / build-and-publish (push) Successful in 26s
Build and Push Version Check Action / build (push) Successful in 18s

This commit is contained in:
Emmaline Autumn 2025-05-06 22:07:43 -06:00
parent 92323d3829
commit a198601c34
3 changed files with 44 additions and 57 deletions

View File

@ -1,15 +1,22 @@
name: Deno Multi-Platform Release name: Deno Multi-Platform Release
description: Compile a Deno CLI tool for multiple platforms and attach to a Gitea release description: Compile and attach binaries to a Gitea release
inputs: inputs:
entrypoint: entrypoint:
description: Path to the Deno entrypoint file (e.g., `src/main.ts`) description: Deno entrypoint file (e.g., src/main.ts)
required: true required: true
compile-flags: compile-flags:
description: Optional space-separated flags to pass to `deno compile` description: Optional flags to pass to `deno compile`
required: false required: false
runs: runs:
using: "docker" using: "composite"
image: git.cyborggrizzly.com/bearmetal/ci-actions/deno-release:latest steps:
args: - name: Set up Deno
- ${{ inputs.entrypoint }} uses: denoland/setup-deno@v1
- ${{ inputs.compile-flags }} with:
deno-version: 2.3.1
- name: Run release script
shell: bash
run: |
chmod +x ./deno-release/release.sh
./deno-release/release.sh "${{ inputs.entrypoint }}" "${{ inputs.compile-flags }}"

65
deno-release/entrypoint.sh Normal file → Executable file
View File

@ -32,20 +32,14 @@ for target in "${platforms[@]}"; do
"$ENTRYPOINT" "$ENTRYPOINT"
done done
API_URL="${CI_SERVER_URL:-https://gitea.example.com}/api/v1" # Generate changelog
RELEASE_ENDPOINT="$API_URL/repos/$OWNER_NAME/$REPO_NAME/releases"
# Get commits since the last tag
PREV_TAG=$(git describe --tags --abbrev=0 "$TAG_NAME"^ 2>/dev/null || echo "") PREV_TAG=$(git describe --tags --abbrev=0 "$TAG_NAME"^ 2>/dev/null || echo "")
if [[ -n "$PREV_TAG" ]]; then if [[ -n "$PREV_TAG" ]]; then
echo "Generating changelog from $PREV_TAG to $TAG_NAME"
COMMITS=$(git log "$PREV_TAG..$TAG_NAME" --pretty=format:"%s (%an)" --no-merges) COMMITS=$(git log "$PREV_TAG..$TAG_NAME" --pretty=format:"%s (%an)" --no-merges)
else else
echo "No previous tag found, generating changelog from initial commit"
COMMITS=$(git log --pretty=format:"%s (%an)" --no-merges) COMMITS=$(git log --pretty=format:"%s (%an)" --no-merges)
fi fi
# Group commits by type
CHANGELOG="" CHANGELOG=""
append_section() { append_section() {
local TYPE="$1" local TYPE="$1"
@ -53,62 +47,40 @@ append_section() {
local EMOJI="$3" local EMOJI="$3"
local MATCHED=$(echo "$COMMITS" | grep -E "^${TYPE}: " || true) local MATCHED=$(echo "$COMMITS" | grep -E "^${TYPE}: " || true)
if [[ -n "$MATCHED" ]]; then if [[ -n "$MATCHED" ]]; then
CHANGELOG+="## $EMOJI $TITLE\\n" CHANGELOG+="## $EMOJI $TITLE\n"
while IFS= read -r line; do while IFS= read -r line; do
# Remove prefix (e.g., "feat: ")
local CLEANED=$(echo "$line" | sed -E "s/^${TYPE}: //") local CLEANED=$(echo "$line" | sed -E "s/^${TYPE}: //")
CHANGELOG+="- $CLEANED\\n" CHANGELOG+="- $CLEANED\n"
done <<< "$MATCHED" done <<< "$MATCHED"
CHANGELOG+="\\n" CHANGELOG+="\n"
fi fi
} }
append_section "feat" "Features" "✨" append_section "feat" "Features" "✨"
append_section "fix" "Fixes" "🐛" append_section "fix" "Fixes" "🐛"
append_section "chore" "Chores" "🧹" append_section "chore" "Chores" "🧹"
append_section "refactor" "Refactors" "🔧"
append_section "docs" "Documentation" "📝"
append_section "test" "Tests" "🧪"
append_section "style" "Style" "🎨"
append_section "ci" "CI/CD" "⚙️"
# Escape quotes for JSON # Fallback if no commits found
CHANGELOG_ESCAPED=$(printf "%s" "$CHANGELOG" | sed 's/"/\\"/g') [[ -z "$CHANGELOG" ]] && CHANGELOG="No commit history found."
RELEASE_BODY=""
# Inject into manual changelog if available
MANUAL_SECTION=""
if [[ -f "CHANGELOG.md" ]]; then if [[ -f "CHANGELOG.md" ]]; then
echo "Looking for manual changelog entry for $TAG_NAME..."
MANUAL_SECTION=$(awk "/^## \\[?$TAG_NAME\\]? /{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md) MANUAL_SECTION=$(awk "/^## \\[?$TAG_NAME\\]? /{flag=1; next} /^## /{flag=0} flag" CHANGELOG.md)
if [[ "$MANUAL_SECTION" == *"<!-- auto-changelog -->"* ]]; then
if [[ -n "$MANUAL_SECTION" ]]; then MANUAL_SECTION=$(echo "$MANUAL_SECTION" | sed "s|<!-- auto-changelog -->|$CHANGELOG|")
echo "Manual entry found for $TAG_NAME"
if grep -q '<!-- auto-changelog -->' <<< "$MANUAL_SECTION"; then
echo "Injecting auto-changelog into manual entry"
FINAL_SECTION=$(sed "s|<!-- auto-changelog -->|$CHANGELOG|" <<< "$MANUAL_SECTION")
else
FINAL_SECTION="$MANUAL_SECTION"
fi
# Escape quotes and newlines
RELEASE_BODY=$(printf "%s" "$FINAL_SECTION" | sed ':a;N;$!ba;s/\n/\\n/g; s/"/\\"/g')
fi fi
fi fi
# Fallback to full auto-changelog RELEASE_BODY="${MANUAL_SECTION:-$CHANGELOG}"
if [[ -z "$RELEASE_BODY" ]]; then RELEASE_BODY_ESCAPED=$(printf "%s" "$RELEASE_BODY" | sed ':a;N;$!ba;s/\n/\\n/g; s/"/\\"/g')
echo "Using full auto-generated changelog"
RELEASE_BODY="$CHANGELOG_ESCAPED"
fi
# Determine prerelease
IS_PRERELEASE="false" IS_PRERELEASE="false"
if [[ "$TAG_NAME" =~ -[0-9A-Za-z] ]]; then [[ "$TAG_NAME" =~ -[0-9A-Za-z] ]] && IS_PRERELEASE="true"
IS_PRERELEASE="true"
fi
echo "Creating release $TAG_NAME (prerelease: $IS_PRERELEASE)..." # Create release
API_URL="${CI_SERVER_URL:-https://git.cyborggrizzly.com}/api/v1"
RELEASE_ENDPOINT="$API_URL/repos/$OWNER_NAME/$REPO_NAME/releases"
RELEASE_JSON=$(curl -sS -X POST "$RELEASE_ENDPOINT" \ RELEASE_JSON=$(curl -sS -X POST "$RELEASE_ENDPOINT" \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \
@ -119,13 +91,12 @@ RELEASE_JSON=$(curl -sS -X POST "$RELEASE_ENDPOINT" \
"name": "$TAG_NAME", "name": "$TAG_NAME",
"draft": false, "draft": false,
"prerelease": $IS_PRERELEASE, "prerelease": $IS_PRERELEASE,
"body": "$RELEASE_BODY" "body": "$RELEASE_BODY_ESCAPED"
} }
EOF EOF
) )
UPLOAD_URL=$(echo "$RELEASE_JSON" | jq -r '.upload_url // .assets_url') UPLOAD_URL=$(echo "$RELEASE_JSON" | jq -r '.upload_url // .assets_url')
for file in "$TMPDIR"/*; do for file in "$TMPDIR"/*; do
FILENAME=$(basename "$file") FILENAME=$(basename "$file")
echo "Uploading $FILENAME..." echo "Uploading $FILENAME..."

View File

@ -1,5 +1,14 @@
name: Version Check & Tag name: Version Check & Tag
description: Ensures version correctness and creates missing git tags description: Ensures version correctness and creates missing git tags
runs: runs:
using: "docker" using: "composite"
image: git.cyborggrizzly.com/bearmetal/ci-actions/version-check:latest steps:
- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: 2.3.1
- name: Run version check
shell: bash
run: |
deno run --allow-read --allow-run version-check/main.ts