reference.md

April 13, 2026 · View on GitHub

Environment Variables Matrix

Variable/SecretRequired ForWhen CheckedExpected ValueNotes
GITHUB_TOKENAll workflowsAlwaysValid GitHub tokenProvided by GitHub Actions
RELEASE_BOT_TOKENRelease workflowsDuring releaseGitHub PATBot token for pushing commits, tags, and creating releases
OSPO_BOT_GPG_PUBGPG signingDuring signingGPG public keyPublic key for verification
OSPO_BOT_GPG_PRIVGPG signingDuring signingBase64 GPG private keyPrivate key for signing
OSPO_BOT_GPG_PASSGPG signingDuring signingGPG key passphrasePassphrase for GPG key
MAVENCENTRAL_USERNAMEMaven Central publishingDuring publishSonatype usernameMaven Central auth
MAVENCENTRAL_PASSWORDMaven Central publishingDuring publishSonatype passwordMaven Central auth
NPM_TOKENNPM publishing to npmjs.orgDuring publishnpmjs.org auth tokenNPM public registry auth (not GitHub Packages)
AUTHORIZED_RELEASE_DEVELOPERSProduction releasesPre-release checkComma-separated usernamesWho can release

Prerequisites Check Matrix

CheckWhen PerformedWhat It ValidatesFails IfHow to Fix
Version MatchRelease workflowTag matches project versionv1.0.0 tag but pom.xml has 1.0.1Ensure tag matches version exactly
GPG KeyWhen signatures: trueGPG key is valid and accessibleKey expired or malformedGenerate new GPG key, export as base64
Maven Central CredsMaven Central publishingCan authenticate to SonatypeInvalid username/passwordVerify Sonatype account credentials
NPM RegistryNPM publishing to npmjs.orgCan authenticate to registryToken expired or invalid scopeGenerate new NPM token with publish scope
Container RegistryContainer in containers[]Can push to registryNo write permissionEnsure packages: write permission
GitHub ReleaseRelease creationCan create releasesNo contents: writeAdd permission to workflow
Protected BranchOn push to mainUser has bypass rightsActor lacks permissionAdd user to bypass list
Artifact ExistenceDuring uploadBuild artifacts existtarget/*.jar not foundEnsure build succeeds first
Container/ContainerfileContainer buildContainerfile existsNo Containerfile at specified pathCreate Containerfile or specify correct path
License CompliancePR checksDependencies have compatible licensesGPL in proprietary projectReview and replace dependencies

Permission Requirements Matrix

WorkflowPermissionWhy NeededIf Missing
PR Workflowcontents: readRead codeCannot checkout
packages: readRead private packagesCannot fetch dependencies
secrets: inheritPass SARIF_UPLOAD_TOKENCode Scanning won't show results
Release Workflowcontents: writeCreate tags/releasesCannot create release
packages: writePush packagesCannot publish artifacts
id-token: writeOIDC for SLSANo attestation
attestations: writeAttach SBOMsNo SBOM attachment
actions: readRead workflowSLSA generation fails
issues: writeUpdate issuesCannot add labels/comments
Dev Workflowcontents: readRead codeCannot checkout
packages: writePush imagesCannot push to ghcr.io

Getting Access to Secrets

How Secrets Work

All secrets are managed centrally at the DiggSweden organization level. As a developer in a DiggSweden project, you:

  1. Don't need to create secrets - They already exist at DiggSweden org level
  2. Request access - Contact your DiggSweden GitHub org owner/admin
  3. Specify which ones - Tell them which secrets your repo needs:
    • Release bot token → Request RELEASE_BOT_TOKEN
    • GPG signing → Request OSPO_BOT_GPG_PRIV, OSPO_BOT_GPG_PASS, and OSPO_BOT_GPG_PUB
    • Maven Central → Request MAVENCENTRAL_USERNAME and MAVENCENTRAL_PASSWORD
    • NPM public registry → Request NPM_TOKEN (only if publishing to npmjs.org)
    • Code Scanning upload → Request SARIF_UPLOAD_TOKEN
  4. Get enabled - DiggSweden admin grants your repository access to the secrets
  • No manual configuration - Developers never touch secret values

RELEASE_BOT_TOKEN

Used for pushing commits, moving tags, and creating GitHub releases.

Requires a fine-grained PAT with contents: write permission, scoped to specific repositories. Classic PATs are rejected.

Note: GitHub Packages uploads use GITHUB_TOKEN (automatic, no configuration needed).

SARIF_UPLOAD_TOKEN

Used for uploading security scan results (SARIF) to GitHub Security / Code Scanning. Without this token, scans still run, SARIF is still generated, and SARIF files are still saved as workflow artifacts, but results won't appear in Security / Code Scanning.

Option A — GitHub App (recommended):

  • Create a GitHub App with code_scanning_alerts: write repository permission
  • Install on target repositories
  • Generate installation token and store as org secret SARIF_UPLOAD_TOKEN

Option B — Fine-grained PAT:

  • Create a fine-grained PAT with "Code scanning alerts" set to Write
  • Scope to the target repositories
  • Store as org secret SARIF_UPLOAD_TOKEN

The token is passed to reusable workflows via secrets: inherit.

Code Scanning categories:

Results appear in the Code Scanning tab grouped by category:

CategoryScannerWhen
megalinterMegaLinterPR quality checks
dependency-reviewTrivyPR dependency scan
opengrep-sastOpenGrepPR SAST scan
scorecardOpenSSF ScorecardScheduled analysis
container-scanTrivyRelease container build

SARIF files are also saved as workflow artifacts (sarif-megalinter, sarif-dependency-review, sarif-opengrep, sarif-scorecard, sarif-container-scan) regardless of whether the token is configured.


Prerequisites

Some features require GitHub secrets:

  • GPG signing needs GPG keys
  • Maven Central needs Sonatype credentials
  • Container registries use GITHUB_TOKEN (automatic)

NOTE: All required GitHub secrets are configured at the DiggSweden organization level. Request access from DiggSweden GitHub administrators to enable secrets for the repository. You can of course also set up your own secrets.

Local Testing

The release workflow includes several validation scripts that you can run locally before creating a tag:

See Scripts Reference for detailed documentation on validation scripts.


Version Tag Format

Tags for releases:

  • Production: v1.0.0, v2.3.4
  • Alpha: v1.0.0-alpha, v1.0.0-alpha.1
  • Beta: v1.0.0-beta, v1.0.0-beta.1
  • Release Candidate: v1.0.0-rc, v1.0.0-rc.1
  • Snapshot: v1.0.0-snapshot, v1.0.0-SNAPSHOT

Validation

The orchestrator performs core runtime validation and normalization when it parses artifacts.yml:

  1. Artifacts config exists and is not empty - The configured file must exist and contain artifacts[]
  2. Container references valid - All containers[].from entries must exist in artifacts[]
  3. Project type valid - Each artifact project-type must be a supported value
  4. Draft-release detection - Non-release tags and -SNAPSHOT tags are normalized into draft-release behavior
  5. SBOM defaults resolved - SBOM generation is derived per artifact when not set explicitly

Additional release-specific validation happens in helper workflows such as validate-release-prerequisites.yml.


Best Practices

  1. Use semantic artifact names - backend-api not app1
  2. Set explicit versions - Don't rely on defaults
  3. Enable security features - Keep SLSA, SBOM, scanning enabled
  4. Multi-platform for production - Always build linux/amd64,linux/arm64
  5. Require authorization for libraries - Prevent accidental releases
  6. Use settings-path for credentials - Don't hardcode in pom.xml