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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
31 changes: 31 additions & 0 deletions .github/workflows/build-addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
# Every prerequisite is checked here, first, and all failures are reported
# together, so a missing secret fails the run in seconds, not after the build.
- name: Pre-flight checks
env:
SERVER_SIGNING_KEYSTORE_BASE64: ${{ secrets.SERVER_SIGNING_KEYSTORE_BASE64 }}
SERVER_SIGNING_STORE_PASSWORD: ${{ secrets.SERVER_SIGNING_STORE_PASSWORD }}
SERVER_SIGNING_KEY_ALIAS: ${{ secrets.SERVER_SIGNING_KEY_ALIAS }}
SERVER_SIGNING_KEY_PASSWORD: ${{ secrets.SERVER_SIGNING_KEY_PASSWORD }}
run: |
failed=0
# Share Your Apps Server's release key (scripts/server-signing-key.sh).
for v in SERVER_SIGNING_KEYSTORE_BASE64 SERVER_SIGNING_STORE_PASSWORD SERVER_SIGNING_KEY_ALIAS SERVER_SIGNING_KEY_PASSWORD; do
if [ -z "${!v}" ]; then
echo "::error::Repository secret $v is missing or empty. See The release signing key in plugins/Share-Your-Apps/docs/share-your-apps-design.md."
failed=1
fi
done
if [ "$failed" != 0 ]; then
echo "Pre-flight checks failed; see the errors above." >&2
exit 1
fi
echo "Pre-flight checks passed."

- name: Checkout plugin-examples
uses: actions/checkout@v4

Expand All @@ -47,6 +70,14 @@ jobs:
cache-disabled: true
add-job-summary: 'never'

- name: Put Share Your Apps Server's release key in place
env:
SERVER_SIGNING_KEYSTORE_BASE64: ${{ secrets.SERVER_SIGNING_KEYSTORE_BASE64 }}
SERVER_SIGNING_STORE_PASSWORD: ${{ secrets.SERVER_SIGNING_STORE_PASSWORD }}
SERVER_SIGNING_KEY_ALIAS: ${{ secrets.SERVER_SIGNING_KEY_ALIAS }}
SERVER_SIGNING_KEY_PASSWORD: ${{ secrets.SERVER_SIGNING_KEY_PASSWORD }}
run: ./scripts/server-signing-key.sh

- name: Refresh libs and build plugins
env:
CODEONTHEGO_REF: ${{ inputs.codeonthego_ref }}
Expand Down
60 changes: 43 additions & 17 deletions .github/workflows/publish-addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,51 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'

- uses: gradle/actions/setup-gradle@v4

- uses: astral-sh/setup-uv@v5

- name: Verify the R2 configuration
# The build below takes a long time. Without this, a renamed variable
# is only discovered after all of it, inside boto3.
# Every prerequisite is checked here, first, and all failures are reported
# together, so a missing secret fails the run in seconds, not after the build.
- name: Pre-flight checks
env:
R2_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
R2_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET_NAME }}
SERVER_SIGNING_KEYSTORE_BASE64: ${{ secrets.SERVER_SIGNING_KEYSTORE_BASE64 }}
SERVER_SIGNING_STORE_PASSWORD: ${{ secrets.SERVER_SIGNING_STORE_PASSWORD }}
SERVER_SIGNING_KEY_ALIAS: ${{ secrets.SERVER_SIGNING_KEY_ALIAS }}
SERVER_SIGNING_KEY_PASSWORD: ${{ secrets.SERVER_SIGNING_KEY_PASSWORD }}
run: |
failed=0
# Share Your Apps Server's release key (scripts/server-signing-key.sh).
for v in SERVER_SIGNING_KEYSTORE_BASE64 SERVER_SIGNING_STORE_PASSWORD SERVER_SIGNING_KEY_ALIAS SERVER_SIGNING_KEY_PASSWORD; do
if [ -z "${!v}" ]; then
echo "::error::Repository secret $v is missing or empty. See The release signing key in plugins/Share-Your-Apps/docs/share-your-apps-design.md."
failed=1
fi
done
# Cloudflare R2, for the publish at the end. Without this, a renamed
# variable is only discovered after the whole build, inside boto3.
for v in R2_ACCOUNT_ID R2_ACCESS_KEY_ID R2_SECRET_ACCESS_KEY R2_BUCKET; do
if [ -z "${!v}" ]; then
echo "$v is empty. Check the repository secrets and variables." >&2
exit 1
echo "::error::$v is empty. Check the repository secrets and variables."
failed=1
fi
done
echo "Publishing to bucket '$R2_BUCKET'."
if [ "$failed" != 0 ]; then
echo "Pre-flight checks failed; see the errors above." >&2
exit 1
fi
echo "Pre-flight checks passed. Publishing to bucket '$R2_BUCKET'."

- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'

- uses: gradle/actions/setup-gradle@v4

- uses: astral-sh/setup-uv@v5

- name: Check names and metadata
run: uv run --directory tools/addons addons --root "$GITHUB_WORKSPACE" check
Expand Down Expand Up @@ -79,6 +97,14 @@ jobs:
echo "revision=$revision" >> "$GITHUB_OUTPUT"
echo "Building against $COGO_REPO@$revision ($COGO_RELEASE)." >> "$GITHUB_STEP_SUMMARY"

- name: Put Share Your Apps Server's release key in place
env:
SERVER_SIGNING_KEYSTORE_BASE64: ${{ secrets.SERVER_SIGNING_KEYSTORE_BASE64 }}
SERVER_SIGNING_STORE_PASSWORD: ${{ secrets.SERVER_SIGNING_STORE_PASSWORD }}
SERVER_SIGNING_KEY_ALIAS: ${{ secrets.SERVER_SIGNING_KEY_ALIAS }}
SERVER_SIGNING_KEY_PASSWORD: ${{ secrets.SERVER_SIGNING_KEY_PASSWORD }}
run: ./scripts/server-signing-key.sh

- name: Build, package, and stage
id: stage
env:
Expand Down
81 changes: 51 additions & 30 deletions .github/workflows/update-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,57 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout plugin-examples
uses: actions/checkout@v4
with:
# PAT from a repo admin so the libs/ push bypasses the main ruleset.
# A fine-grained PAT must use the organization as its resource owner,
# not a personal account, or every push returns 403. The next step
# checks this. GITHUB_TOKEN is only a fallback to keep checkout
# working; it cannot bypass the ruleset, so the check rejects it.
token: ${{ secrets.ADMIN_PERSONAL_ACCESS_TOKEN || github.token }}

# The build below takes ~30 minutes. Without this guard, a token that
# cannot write to this repo throws all of that away at "Commit updated
# jars". Check the token first so the run fails in seconds instead.
- name: Verify the push token
# Every prerequisite is checked here, first, and all failures are reported
# together, so a missing secret fails the run in seconds, not after the build.
- name: Pre-flight checks
env:
ADMIN_PAT: ${{ secrets.ADMIN_PERSONAL_ACCESS_TOKEN }}
GH_TOKEN: ${{ secrets.ADMIN_PERSONAL_ACCESS_TOKEN || github.token }}
GH_TOKEN: ${{ secrets.ADMIN_PERSONAL_ACCESS_TOKEN }}
SERVER_SIGNING_KEYSTORE_BASE64: ${{ secrets.SERVER_SIGNING_KEYSTORE_BASE64 }}
SERVER_SIGNING_STORE_PASSWORD: ${{ secrets.SERVER_SIGNING_STORE_PASSWORD }}
SERVER_SIGNING_KEY_ALIAS: ${{ secrets.SERVER_SIGNING_KEY_ALIAS }}
SERVER_SIGNING_KEY_PASSWORD: ${{ secrets.SERVER_SIGNING_KEY_PASSWORD }}
run: |
failed=0
# Share Your Apps Server's release key (scripts/server-signing-key.sh).
for v in SERVER_SIGNING_KEYSTORE_BASE64 SERVER_SIGNING_STORE_PASSWORD SERVER_SIGNING_KEY_ALIAS SERVER_SIGNING_KEY_PASSWORD; do
if [ -z "${!v}" ]; then
echo "::error::Repository secret $v is missing or empty. See The release signing key in plugins/Share-Your-Apps/docs/share-your-apps-design.md."
failed=1
fi
done
# The push token. The build takes ~30 minutes; without this, a token that
# cannot write to this repo throws all of that away at "Commit updated jars".
org="${GITHUB_REPOSITORY%%/*}"

if [ -z "$ADMIN_PAT" ]; then
if [ -z "$GH_TOKEN" ]; then
echo "::error::ADMIN_PERSONAL_ACCESS_TOKEN is not set. GITHUB_TOKEN cannot bypass the ${org} main ruleset, so the push would fail."
exit 1
fi

if ! repo=$(gh api "repos/${GITHUB_REPOSITORY}" 2>/dev/null); then
failed=1
elif ! repo=$(gh api "repos/${GITHUB_REPOSITORY}" 2>/dev/null); then
echo "::error::The token cannot see ${GITHUB_REPOSITORY}. A fine-grained PAT must use resource owner '${org}' (the organization). A token owned by a personal account cannot reach ${org} repositories."
exit 1
failed=1
else
who=$(gh api user --jq .login 2>/dev/null || echo '(unknown)')
push=$(printf '%s' "$repo" | jq -r '.permissions.push // false')
echo "Token identity: ${who}. Push permission: ${push}."
if [ "$push" != "true" ]; then
echo "::error::The token authenticates as '${who}' but cannot write to ${GITHUB_REPOSITORY}. Grant it 'Contents: Read and write' with resource owner '${org}'."
failed=1
fi
fi

who=$(gh api user --jq .login 2>/dev/null || echo '(unknown)')
push=$(printf '%s' "$repo" | jq -r '.permissions.push // false')
echo "Token identity: ${who}. Push permission: ${push}."

if [ "$push" != "true" ]; then
echo "::error::The token authenticates as '${who}' but cannot write to ${GITHUB_REPOSITORY}. Grant it 'Contents: Read and write' with resource owner '${org}'."
if [ "$failed" != 0 ]; then
echo "Pre-flight checks failed; see the errors above." >&2
exit 1
fi
echo "Pre-flight checks passed."

- name: Checkout plugin-examples
uses: actions/checkout@v4
with:
# PAT from a repo admin so the libs/ push bypasses the main ruleset.
# A fine-grained PAT must use the organization as its resource owner,
# not a personal account, or every push returns 403. Pre-flight
# checks this. GITHUB_TOKEN is only a fallback to keep checkout
# working; it cannot bypass the ruleset, so the check rejects it.
token: ${{ secrets.ADMIN_PERSONAL_ACCESS_TOKEN || github.token }}

- name: Set up JDK 17
uses: actions/setup-java@v4
Expand All @@ -71,6 +84,14 @@ jobs:
RUN_NUMBER: ${{ github.run_number }}
run: echo "name=build-$(date -u +%Y-%m-%d)-${RUN_NUMBER}" >> "$GITHUB_OUTPUT"

- name: Put Share Your Apps Server's release key in place
env:
SERVER_SIGNING_KEYSTORE_BASE64: ${{ secrets.SERVER_SIGNING_KEYSTORE_BASE64 }}
SERVER_SIGNING_STORE_PASSWORD: ${{ secrets.SERVER_SIGNING_STORE_PASSWORD }}
SERVER_SIGNING_KEY_ALIAS: ${{ secrets.SERVER_SIGNING_KEY_ALIAS }}
SERVER_SIGNING_KEY_PASSWORD: ${{ secrets.SERVER_SIGNING_KEY_PASSWORD }}
run: ./scripts/server-signing-key.sh

# Refreshes libs/ from CodeOnTheGo@stage, then proves every plugin still
# compiles against the new jars. Templates use no jars, so none are built.
- name: Refresh libs and build plugins
Expand Down
35 changes: 35 additions & 0 deletions plugins/Share-Your-Apps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build output and caches
build/
.gradle/
.kotlin/
.cxx/
.externalNativeBuild/
captures/
*.hprof

# IDE and editor state (.cg is CodeOnTheGo's)
.cg/
.idea/
*.iml
.DS_Store
Thumbs.db

# Machine-specific settings
local.properties

# Signing: the keystore and its passwords must never be committed
release.keystore
release.properties
keystore.properties
*.jks
*.keystore
*.p12
*.pfx

# The bundled server APK is a build output, copied in before each release (see README)
src/main/assets/share-your-apps-server.apk

# Media (demo video, narration recordings) is kept out of git
*.webm
*.mp3
*.mp4
Loading
Loading