Skip to content

disable Update update-build.yml #217

disable Update update-build.yml

disable Update update-build.yml #217

Workflow file for this run

name: Auto update build
# on:
# schedule:
# - cron: "30 0 * * *" # or '0 0 * * 0' # At 00:00 on Sunday
# workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
auto-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
security-events: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"
- name: Print latest tag
shell: bash
env:
LATEST_TAG: ${{ steps.previoustag.outputs.tag }}
run: |
echo Latest tag: $LATEST_TAG
- name: Install cosign
uses: sigstore/cosign-installer@v3.5.0
with:
cosign-release: 'v2.2.4'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm64/v8
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/akmalovaa/nginx-vts:latest
ghcr.io/akmalovaa/nginx-vts:${{ steps.previoustag.outputs.tag }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.30.0
# env:
# TRIVY_SEVERITY: CRITICAL
# TRIVY_EXIT_CODE: 1
with:
image-ref: 'ghcr.io/akmalovaa/nginx-vts:${{ steps.previoustag.outputs.tag }}'
format: 'sarif'
output: 'trivy-results.sarif'
# exit-code: '1'
# ignore-unfixed: true
# vuln-type: 'os,library'
# severity: 'CRITICAL' # HIGH
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
# - name: grype / sarif to markdown
# if: success() || failure()
# id: sarif-to-markdown
# uses: 11notes/action-sarif-to-markdown@v1.2.0
# with:
# sarif_file: 'trivy-results.sarif'
# - name: grype / report / print
# run: echo ${{ steps.sarif-to-markdow.outputs.markdown }}
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
TAGS: |
ghcr.io/akmalovaa/nginx-vts:latest
ghcr.io/akmalovaa/nginx-vts:${{ steps.previoustag.outputs.tag }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}