ESPSomfy-RTS/.github/set_version.sh
cjkas 5c57d1a2cd ci: signed release provenance, pinned dependencies, security scanning
- Release files get a SHA256SUMS file and a Sigstore-signed build
  provenance attestation (gh attestation verify).
- The workflows read the repo only. A new release job, which runs no
  build tools, is the only one that can write: it uploads the files with
  gh and pushes the version bump. The third-party release actions are gone.
- Every action is pinned to a commit SHA, esptool and the libraries to
  exact versions. The release tag reaches the shell through env, and
  set_version.sh rejects tags that aren't versions.
- New workflows: CodeQL (C++ via the native build, JS, Python, Actions),
  OpenSSF Scorecard, zizmor. Dependabot moves the action pins.
- SECURITY.md: private reporting, checking a download. README badges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 13:27:48 +01:00

17 lines
733 B
Bash

#!/usr/bin/env bash
# Writes a release's version into the sources: bash .github/set_version.sh v4.0.1
# The build jobs build with it, the release job commits it.
set -euo pipefail
VERSION="${1#v}"
# The version goes into sed replacements and into the firmware, so only
# digits, letters, dots and dashes: 4.0.1, 4.0.0.beta, 4.1.0-rc1.
if [[ ! "$VERSION" =~ ^[0-9]+(\.[0-9A-Za-z-]+)*$ ]]; then
echo "Not a version: $1" >&2
exit 1
fi
sed -i "s/#define FW_VERSION \"v[0-9.]*\"/#define FW_VERSION \"v${VERSION}\"/" src/ConfigSettings.h
sed -i "s/^[0-9.].*/${VERSION}/" data-src/appversion
sed -i "s/\?v=[0-9.]*c/?v=${VERSION}c/g" data-src/index.html
sed -i "s/appVersion = 'v[0-9.]*'/appVersion = 'v${VERSION}'/" data-src/index.js