Skip to content

[StepSecurity] Apply security best practices #12

[StepSecurity] Apply security best practices

[StepSecurity] Apply security best practices #12

Workflow file for this run

name: build .NET 7
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch: {}
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
PUBLISH: ${{ github.ref == 'refs/heads/master' }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
with:
egress-policy: audit
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
- uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
id: buildx
with:
install: true
version: latest
- uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
if: ${{ env.PUBLISH }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=sha
type=edge
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1
id: build
with:
file: Dockerfile
context: .
push: ${{ env.PUBLISH }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}