Bump actions/checkout from 4 to 6 #756
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Blackduck Scan | |
| on: | |
| push: | |
| branches: | |
| - "integration/main" | |
| pull_request: | |
| branches: | |
| - "integration/main" | |
| jobs: | |
| validate-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Get Latest Release Version | |
| id: get_latest_release | |
| run: | | |
| # Fetch all tags | |
| git fetch --tags --force | |
| # Get the latest tag using git tag with sorting | |
| LATEST_TAG=$(git tag -l 'v*' | sort -V | tail -n 1) | |
| LATEST_RELEASE=$(echo "$LATEST_TAG" | sed 's/^v//') | |
| echo "Latest release: $LATEST_RELEASE" | |
| echo "LATEST_RELEASE=${LATEST_RELEASE}" >> $GITHUB_ENV | |
| - name: Validate DETECT_PROJECT_VERSION_NAME | |
| id: validate_version | |
| run: | | |
| LATEST_VERSION=${LATEST_RELEASE} | |
| CURRENT_VERSION=$(grep -oP 'DETECT_PROJECT_VERSION_NAME=\K[0-9.]+' scripts/bd_scan.bash) | |
| echo "Latest version released: $LATEST_VERSION" | |
| echo "Current version for scanning: $CURRENT_VERSION" | |
| # Compare versions - current should be greater than latest | |
| if [ "$(printf '%s\n' "$LATEST_VERSION" "$CURRENT_VERSION" | sort -V | tail -n 1)" == "$LATEST_VERSION" ]; then | |
| echo "Error: DETECT_PROJECT_VERSION_NAME ($CURRENT_VERSION) must be greater than the latest release version ($LATEST_VERSION) in bd_scan.bash script." | |
| exit 1 | |
| fi | |
| echo "✓ Version validation passed: $CURRENT_VERSION > $LATEST_VERSION" | |
| build: | |
| needs: validate-version | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' # See 'Supported distributions' for available options | |
| java-version: '17' | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - uses: actions/checkout@v6 | |
| - name: Run Go Mod Tidy | |
| run: go mod tidy | |
| - name: Build | |
| env: | |
| BLACKDUCK_URL: ${{ secrets.BLACKDUCK_URL }} | |
| BLACKDUCK_API_TOKEN: ${{ secrets.BLACKDUCK_API_TOKEN }} | |
| run: | | |
| bash scripts/bd_scan.bash $BLACKDUCK_URL $BLACKDUCK_API_TOKEN |