feat: Update workflow to be able to scan projects using extractors #14
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: "Build" | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| actions: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.rust-version }} | |
| cancel-in-progress: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust-version: [ stable, beta, nightly ] | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v4 | |
| - name: "Setup - Rust Toolchain" | |
| uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 | |
| if: steps.changes.outputs.src == 'true' | |
| with: | |
| components: clippy,rustfmt | |
| toolchain: ${{ matrix.rust-version }} | |
| - name: "Restore cached Cargo" | |
| id: cache-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-${{ matrix.rust-version }}-cargo | |
| - name: "Formatting Check" | |
| run: cargo fmt --check | |
| - name: "Run build..." | |
| run: | | |
| set -e | |
| cargo build --workspace | |
| cargo test --workspace | |
| - name: Save Cargo / Rust Cache | |
| id: cache-save | |
| if: ${{ github.event_name == 'push' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ steps.cache-restore.outputs.cache-primary-key }} | |
| container: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| env: | |
| REGISTRY: ghcr.io | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 | |
| - name: Set Container Metadata | |
| uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 | |
| id: meta | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }} | |
| tags: | | |
| # latest / main | |
| type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
| - name: Build Container ${{ github.repository }} | |
| uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 | |
| id: build | |
| with: | |
| file: "./Dockerfile" | |
| context: . | |
| push: false | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # SBOM Settings | |
| sbom: true | |
| # Upload Software Bill of Materials (SBOM) to GitHub | |
| - name: Upload SBOM | |
| uses: advanced-security/spdx-dependency-submission-action@5530bab9ee4bbe66420ce8280624036c77f89746 # v0.1.1 | |
| with: | |
| filePath: '.' | |
| filePattern: '*.spdx.json' |