fix(reusable): release from any tag, Qodana in subdirectories #3

Merged
poli0981 merged 1 commits from fix/tag-prefixes-qodana-subdirs into main 2026-11-24 09:27:24 +00:00
4 changed files with 38 additions and 6 deletions

No files matched your search

+2 -1
View File
@@ -54,7 +54,8 @@ jobs:
github.event.workflow_run.event == 'release' ||
github.event.workflow_run.event == 'workflow_dispatch' ||
contains(github.event.workflow_run.path, '@refs/tags/v') ||
contains(github.event.workflow_run.path, '@refs/tags/desktop-v')
contains(github.event.workflow_run.path, '@refs/tags/desktop-v') ||
contains(github.event.workflow_run.path, '@refs/tags/android-v')
) &&
(
github.event.workflow_run.conclusion == 'success' ||
+6 -4
View File
@@ -12,7 +12,7 @@
# with: { name: r2-release, path: r2-release/ }
# publish:
# needs: build
# if: startsWith(github.ref, 'refs/tags/v')
# if: startsWith(github.ref, 'refs/tags/')
# permissions:
# contents: read
# uses: poli0981/.github/.gitea/workflows/publish-r2.yml@<full-sha> # ops vYYYY.MM.N
@@ -39,8 +39,10 @@
# stale feed — the job fails before uploading anything
# - rclone pinned + SHA-256 verified; configured only through env vars, with an empty
# config file so the host-mode Windows runner never picks up a local rclone.conf
# - runs only on a v* tag: a tag push, or workflow_dispatch started on that tag
# (runbook §2 rule 10), the same guard as the release jobs in the reusables
# - runs only on a tag: a tag push, or workflow_dispatch started on that tag
# (runbook §2 rule 10). Any tag name: a repo that releases several things
# tags each its own way (free-steam-games-list: v* for the dataset,
# desktop-v* and android-v* for the apps)
name: Reusable / Publish to R2
@@ -83,7 +85,7 @@ permissions:
jobs:
publish:
# Release credentials: tag pushes or manual runs only (runbook §2 rule 10)
if: ${{ startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
if: ${{ startsWith(github.ref, 'refs/tags/') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}
runs-on: ${{ inputs.runs-on }}
timeout-minutes: 30
permissions:
+27
View File
@@ -25,6 +25,10 @@
# `dotnet-version: 10.0.x` → native mode in HOST MODE on the maintainer PC (runbook §3.5).
# Two Qodana Cloud projects in one repo (e.g. Rust + TS): call this twice with `config`,
# `artifact-name` and each project's token.
# A project in a subdirectory (free-steam-games-list: web/, scripts/, web/src-tauri/):
# `project-dir: <dir>` and `repository-root: .`, and `working-directory: <dir>` when its
# package.json is there too. `extra-args` reaches `qodana scan` as is, split on spaces
# (qodana-rust in Docker needs `-u root -e CARGO_HOME=/data/cache/cargo`).
#
# How it runs:
# - Native mode by default (`--within-docker false`): on ubuntu-latest the job already is a
@@ -64,6 +68,18 @@ on:
description: 'Directory to analyse (empty = repo root)'
type: string
default: ''
repository-root:
description: "Git root passed as --repository-root when project-dir is a subdirectory (usually '.'); empty = not passed"
type: string
default: ''
working-directory:
description: 'Directory holding package.json and the lockfile, where Node dependencies are installed'
type: string
default: '.'
extra-args:
description: "Extra `qodana scan` arguments, split on spaces (e.g. qodana-rust in Docker: '-u root -e CARGO_HOME=/data/cache/cargo')"
type: string
default: ''
package-manager:
description: "'none' | 'npm' | 'pnpm': install Node dependencies (scripts off) before the scan"
type: string
@@ -119,6 +135,8 @@ jobs:
LINTER: ${{ inputs.linter }}
CONFIG: ${{ inputs.config }}
PROJECT_DIR: ${{ inputs.project-dir }}
REPOSITORY_ROOT: ${{ inputs.repository-root }}
EXTRA_ARGS: ${{ inputs.extra-args }}
WITHIN_DOCKER: ${{ inputs.within-docker }}
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
DOTNET_NOLOGO: '1'
@@ -146,6 +164,8 @@ jobs:
- name: Setup pnpm
if: ${{ inputs.package-manager == 'pnpm' }}
uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
with:
package_json_file: ${{ inputs.working-directory }}/package.json
- name: Setup Node.js
if: ${{ inputs.package-manager != 'none' }}
@@ -154,11 +174,13 @@ jobs:
node-version: ${{ inputs.node-version-file == '' && inputs.node-version || '' }}
node-version-file: ${{ inputs.node-version-file }}
cache: ${{ inputs.package-manager }}
cache-dependency-path: ${{ inputs.working-directory }}/${{ inputs.package-manager == 'pnpm' && 'pnpm-lock.yaml' || 'package-lock.json' }}
# --ignore-scripts: no dependency runs code at install time in a job that holds a token.
# The analysis needs the packages' types, not their builds.
- name: Install dependencies (scripts off)
if: ${{ inputs.package-manager != 'none' }}
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.package-manager == 'pnpm' && 'pnpm install --frozen-lockfile --ignore-scripts' || 'npm ci --ignore-scripts' }}
- name: Prepare
@@ -193,6 +215,9 @@ jobs:
if [ -n "$LINTER" ]; then args+=(--linter "$LINTER"); fi
if [ -n "$CONFIG" ]; then args+=(--config "$CONFIG"); fi
if [ -n "$PROJECT_DIR" ]; then args+=(--project-dir "$PROJECT_DIR"); fi
if [ -n "$REPOSITORY_ROOT" ]; then args+=(--repository-root "$REPOSITORY_ROOT"); fi
read -r -a extra <<< "$EXTRA_ARGS"
args+=("${extra[@]}")
qodana --version
qodana "${args[@]}"
@@ -225,6 +250,8 @@ jobs:
if ($env:LINTER) { $scanArgs += @('--linter', $env:LINTER) }
if ($env:CONFIG) { $scanArgs += @('--config', $env:CONFIG) }
if ($env:PROJECT_DIR) { $scanArgs += @('--project-dir', $env:PROJECT_DIR) }
if ($env:REPOSITORY_ROOT) { $scanArgs += @('--repository-root', $env:REPOSITORY_ROOT) }
$scanArgs += @($env:EXTRA_ARGS -split '\s+' | Where-Object { $_ })
qodana --version
& qodana @scanArgs
exit $LASTEXITCODE
+3 -1
View File
@@ -344,13 +344,15 @@ For uploads that are not done by `vpk` (Tauri, extension zips, other files).
- Tool: rclone (pinned version, checksum verified), configured only through env vars, as in the server backup script:
`RCLONE_CONFIG_R2_TYPE=s3`, `RCLONE_CONFIG_R2_PROVIDER=Cloudflare`, `RCLONE_CONFIG_R2_ENDPOINT=https://<account>.r2.cloudflarestorage.com`, `RCLONE_CONFIG_R2_REGION=auto`, `RCLONE_CONFIG_R2_NO_CHECK_BUCKET=true`, keys from secrets.
- Steps: `rclone copy <versioned-dir> r2:poli0981-releases/<app>/` (never `sync`, never `delete`), then `rclone copyto` each feed file, then `curl -fsSI https://releases.poli0981.dev/<app>/<feed>` as a smoke test.
- Runs on any tag (`refs/tags/*`, push or dispatch), not only `v*`: free-steam-games-list releases its apps from `desktop-v*` and `android-v*` tags (ops v2026.11.3). Feeds land at `<app>/<file name>`, so two feeds of one app need two names (`latest.json`, `android-latest.json`).
- Permissions: `contents: read` only.
### 4.5 `reusable-qodana.yml` (reusable, new)
Qodana CLI scan for any stack; replaces `JetBrains/qodana-action`.
- Inputs: `runs-on` (`ubuntu-latest` | `windows-latest`), `linter`, `config`, `project-dir`, `package-manager` (`none` | `npm` | `pnpm`; installs with scripts off), `node-version` / `node-version-file`, `dotnet-version` / `dotnet-global-json-file`, `prepare-command`, `within-docker`, `artifact-name`. Secret: `QODANA_TOKEN`.
- Inputs: `runs-on` (`ubuntu-latest` | `windows-latest`), `linter`, `config`, `project-dir`, `repository-root`, `working-directory` (where `package.json` and the lockfile are), `extra-args`, `package-manager` (`none` | `npm` | `pnpm`; installs with scripts off), `node-version` / `node-version-file`, `dotnet-version` / `dotnet-global-json-file`, `prepare-command`, `within-docker`, `artifact-name`. Secret: `QODANA_TOKEN`.
- A project in a subdirectory passes `project-dir: <dir>` with `repository-root: .`; `extra-args` reaches `qodana scan` split on spaces (qodana-rust in Docker: `-u root -e CARGO_HOME=/data/cache/cargo`). Added in ops v2026.11.3 for free-steam-games-list's three projects.
- Native mode by default. `within-docker: true` is for linters without one (`qodana-rust`): on `windows-latest` Docker Desktop runs the image (**VERIFY**).
- CLI pinned and SHA-256 verified; the report stays an artifact (no code-scanning UI); runs started by `renovate-bot` skip the job.