Skip to content

Merge pull request #1656 from DependencyTrack/dependabot/github_actio… #2695

Merge pull request #1656 from DependencyTrack/dependabot/github_actio…

Merge pull request #1656 from DependencyTrack/dependabot/github_actio… #2695

Workflow file for this run

name: Build CI
on:
push:
branches:
- 'main' # Default branch
- 'feature-**' # Feature branches
pull_request:
branches:
- 'main' # Default branch
- 'feature-**' # Feature branches
workflow_dispatch:
inputs:
app-version:
type: string
required: false
default: ''
description: 'Override the derived app-version (e.g. 5.0.0 or 5.0.0-rc.1). Leave empty to use the derived snapshot tag (e.g. 5-snapshot).'
permissions: {}
jobs:
read-version:
name: Read Version
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
major: ${{ steps.parse.outputs.major }}
steps:
- name: Checkout Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # tag=v7.0.0
with:
persist-credentials: false
- name: Parse Version from package.json
id: parse
run: |-
VERSION=$(jq -r '.version' package.json)
MAJOR="${VERSION%%.*}"
echo "major=${MAJOR}" >> "$GITHUB_OUTPUT"
call-build:
name: Build
needs:
- read-version
uses: ./.github/workflows/_meta-build.yaml
with:
app-version: ${{ inputs.app-version || format('{0}-snapshot', needs.read-version.outputs.major) }}
publish-container: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'feature-') }}
ref-name: ${{ github.ref_name }}
permissions:
packages: write # Required to push images to ghcr.io
secrets:
registry-0-usr: ${{ github.repository_owner }}
registry-0-psw: ${{ github.repository_owner == 'DependencyTrack' && secrets.BOT_IMAGE_PUSH_TOKEN || secrets.GITHUB_TOKEN }}