Skip to content

Publish Docker image #22

Publish Docker image

Publish Docker image #22

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Publish Docker image
on:
schedule:
- cron: "0 0 1 * *"
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
actions: read
contents: read
security-events: write
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4.1.7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: georgedavisibexlabs/publish-sarif-to-jira
- name: Build and push Docker image
uses: docker/build-push-action@v6.6.1
with:
context: .
file: Dockerfile
push: true
sbom: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v4.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: georgedavisibexlabs/publish-sarif-to-jira
short-description: Publish SARIF data to JIRA
readme-filepath: ./DOCKER.md
enable-url-completion: true
- name: Run Trivy Image scanner
uses: aquasecurity/trivy-action@0.24.0
with:
scan-type: 'image'
image-ref: 'georgedavisibexlabs/publish-sarif-to-jira:main'
limit-severities-for-sarif: true
trivy-config: .github/config/trivy-sarif.yaml
- name: Upload Trivy Image scan results
uses: actions/upload-artifact@v4.3.6
with:
name: trivy-image-scan-results
path: trivy-image-scan-results.sarif
retention-days: 30
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-image-scan-results.sarif'