[TEST] Test new GHA perms #198
Workflow file for this run
This file contains 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: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
# Tuesday at 10. One day after the CircleCI scheduled upddate | |
# See: https://github.com/CircleCI-Public/cimg-base/blob/main/.circleci/schedule.json | |
- cron: '0 10 * * 2' | |
workflow_dispatch: | |
jobs: | |
build_push_check: | |
name: Build docker image, publish it and run vuln scanner against it | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
packages: write # for image publication to GitHub Packages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # 3.6.1 | |
- name: Login to ghcr.io | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # 3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Free Disk Space (Ubuntu) # Reclaim disk space for build | |
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
with: | |
docker-images: false # Do not remove locally built images (including trivy scanner) | |
- name: Build images | |
id: build | |
run: ./build | |
- name: Test images | |
run: ./build --test | |
- name: Describe images | |
run: ./build --describe >> $GITHUB_STEP_SUMMARY | |
- name: Push images | |
run: ./build --push | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # v0.24.0 | |
with: | |
image-ref: '${{ steps.build.outputs.LATEST_IMAGE_TAG }}' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
severity: 'CRITICAL,HIGH' | |
limit-severities-for-sarif: true | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: 'trivy-results.sarif' | |
keepalive-job: | |
name: Keep repository alive to prevent workflows to be disabled | |
if: ${{ always() }} | |
needs: build_push_check | |
permissions: | |
actions: write # for gautamkrishnar/keepalive-workflow to keep the workflow alive | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7 | |
- name: Keep workflow alive | |
uses: gautamkrishnar/keepalive-workflow@24ba73b43d5ea8d2b3d56fb9b8de951ba9a3dd18 # v2.0.6 |