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
6 changes: 3 additions & 3 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,15 @@ jobs:

echo "Found Jira ticket: $JIRA_TICKET"

# Validate NEXT_RELEASE_VERSION exists and exactly two digits, dot, two digits
# Validate NEXT_RELEASE_VERSION format
if [ -z "$NEXT_RELEASE_VERSION" ]; then
echo "ERROR: NEXT_RELEASE_VERSION variable is not set"
exit 1
fi

if [[ ! "$NEXT_RELEASE_VERSION" =~ ^[0-9]{2}\.[0-9]{2}$ ]]; then
if [[ ! "$NEXT_RELEASE_VERSION" =~ ^[0-9]{2}\.[0-9]{2}(\.[0-9]+)?$ ]]; then
echo "ERROR: NEXT_RELEASE_VERSION format is invalid: $NEXT_RELEASE_VERSION"
echo "Expected format: YY.ww (two digits, dot, two digits, e.g., 25.50)"
echo "Expected format: YY.ww[.patch] (e.g., 25.50 or 25.50.1)"
exit 1
fi

Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
schedule:
- cron: '0 12 * * *' # Daily at 12:00 PM UTC
workflow_dispatch:
inputs:
hotfix_version:
description: 'Version stamp for an off-cycle release (e.g. 26.38.1). Still merges stage into main and builds main.'
required: false
type: string

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -485,15 +490,15 @@ jobs:

- name: Validate release version
env:
NEXT_RELEASE_VERSION: ${{ vars.NEXT_RELEASE_VERSION }}
NEXT_RELEASE_VERSION: ${{ github.event.inputs.hotfix_version || vars.NEXT_RELEASE_VERSION }}
run: |
if [ -z "$NEXT_RELEASE_VERSION" ]; then
echo "ERROR: NEXT_RELEASE_VERSION variable is not set"
exit 1
fi
if [[ ! "$NEXT_RELEASE_VERSION" =~ ^[0-9]{2}\.[0-9]{2}$ ]]; then
if [[ ! "$NEXT_RELEASE_VERSION" =~ ^[0-9]{2}\.[0-9]{2}(\.[0-9]+)?$ ]]; then
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
echo "ERROR: NEXT_RELEASE_VERSION format is invalid: $NEXT_RELEASE_VERSION"
echo "Expected format: YY.ww (two digits, dot, two digits, e.g., 25.50)"
echo "Expected format: YY.ww[.patch] (e.g., 25.50 or 25.50.1)"
exit 1
fi
echo "Validated NEXT_RELEASE_VERSION: $NEXT_RELEASE_VERSION"
Expand All @@ -505,7 +510,7 @@ jobs:
- name: Assemble Release APK
env:
INCLUDE_LLAMA_ASSETS: "true"
NEXT_RELEASE_VERSION: ${{ vars.NEXT_RELEASE_VERSION }}
NEXT_RELEASE_VERSION: ${{ github.event.inputs.hotfix_version || vars.NEXT_RELEASE_VERSION }}
run: |
variant_upper=$(echo "${{ matrix.variant }}" | tr '[:lower:]' '[:upper:]')
flox activate -d flox/base -- ./gradlew :app:assemble${variant_upper}Release --no-daemon \
Expand Down
50 changes: 35 additions & 15 deletions .github/workflows/weekly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Weekly release (manual)

on:
workflow_dispatch:
inputs:
hotfix_version:
description: 'Version for an off-cycle release (e.g. 26.38.1). Publishes the current build under this version instead of the CalVer week.'
required: false
type: string

permissions:
contents: read
Expand All @@ -27,12 +32,26 @@ jobs:

- name: Compute CalVer version
id: compute
env:
HOTFIX_VERSION: ${{ github.event.inputs.hotfix_version }}
run: |
VERSION=$(date -u +%g.%V)
if [[ -n "$HOTFIX_VERSION" ]]; then
if [[ ! "$HOTFIX_VERSION" =~ ^[0-9]{2}\.[0-9]{2}(\.[0-9]+)?$ ]]; then
echo "::error::Invalid hotfix version format: $HOTFIX_VERSION"
exit 1
fi
VERSION="$HOTFIX_VERSION"
else
VERSION=$(date -u +%g.%V)
fi
NEXT_VERSION=$(date -u -d "+7 days" +%g.%V)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "next_version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
echo "Releasing $VERSION (next will be $NEXT_VERSION)"
if [[ -n "$HOTFIX_VERSION" ]]; then
echo "Releasing hotfix $VERSION (NEXT_RELEASE_VERSION left unchanged)"
else
echo "Releasing $VERSION (next will be $NEXT_VERSION)"
fi

- name: Look up previous CalVer tag
id: previous
Expand All @@ -41,7 +60,7 @@ jobs:
shell: flox activate -d flox/base -- bash -eo pipefail {0}
run: |
PREVIOUS_TAG=$(gh release list --json tagName \
--jq '[.[] | select(.tagName | test("^[0-9]+\\.[0-9]+$"))] | .[0].tagName // ""')
--jq '[.[] | select(.tagName | test("^[0-9]+\\.[0-9]+(\\.[0-9]+)?$"))] | .[0].tagName // ""')
echo "previous_tag=$PREVIOUS_TAG" >> "$GITHUB_OUTPUT"
echo "Previous CalVer tag: ${PREVIOUS_TAG:-none}"

Expand Down Expand Up @@ -198,20 +217,20 @@ jobs:
exit 0
fi

# A hotfix cut against a superseded release must not steal the "Latest"
# badge from the newer release that is already published.
IS_LATEST=true
if [[ -n "$PREVIOUS_TAG" ]] \
&& [[ "$(printf '%s\n%s\n' "$VERSION" "$PREVIOUS_TAG" | sort -V | tail -n1)" != "$VERSION" ]]; then
Comment thread
dara-abijo-adfa marked this conversation as resolved.
Resolved
IS_LATEST=false
fi
echo "Marking $VERSION as latest: $IS_LATEST (previous tag: ${PREVIOUS_TAG:-none})"

ARGS=(--target "$GITHUB_SHA" --latest="$IS_LATEST" --title "$VERSION" --generate-notes)
if [[ -n "$PREVIOUS_TAG" && "$PREVIOUS_TAG" != "$VERSION" ]]; then
gh release create "$VERSION" \
--target "$GITHUB_SHA" \
--latest \
--title "$VERSION" \
--generate-notes \
--notes-start-tag "$PREVIOUS_TAG"
else
gh release create "$VERSION" \
--target "$GITHUB_SHA" \
--latest \
--title "$VERSION" \
--generate-notes
ARGS+=(--notes-start-tag "$PREVIOUS_TAG")
fi
gh release create "$VERSION" "${ARGS[@]}"

upload-r2:
needs: [prepare, pull-apk]
Expand Down Expand Up @@ -294,6 +313,7 @@ jobs:
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}

- name: Set NEXT_RELEASE_VERSION repo variable
if: ${{ github.event.inputs.hotfix_version == '' }}
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
NEXT_VERSION: ${{ needs.prepare.outputs.next_version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ val Project.releaseVersion: String
.orNull
.orEmpty()
.trim()
if (raw.isNotEmpty() && !Regex("""^\d{2}\.\d{2}$""").matches(raw)) {
if (raw.isNotEmpty() && !Regex("""^\d{2}\.\d{2}(\.\d+)?$""").matches(raw)) {
throw GradleException(
"Invalid next_release_version '$raw'; expected YY.ww (two digits, dot, two digits), e.g. 25.47",
"Invalid next_release_version '$raw'; expected YY.ww with an optional patch, e.g. 25.47 or 25.47.1",
)
}
return raw
Expand Down
Loading