Release v1.0.3-1 #29
Workflow file for this run
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: CI | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| COMPOSE_DOCKER_CLI_BUILD: 1 | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| on: | |
| pull_request: | |
| branches: [ "main", "next" ] | |
| paths-ignore: [ "docs/**", "README.md" ] | |
| push: | |
| branches: [ "main", "next" ] | |
| paths-ignore: [ "docs/**", "README.md" ] | |
| release: | |
| types: [ created ] | |
| jobs: | |
| generate-openapi-doc: | |
| name: Generate OpenAPI documentation | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| security-events: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Generate Redoc static documentation | |
| run: npx -y @redocly/cli build-docs openapi.json --output=doc/index.html | |
| - name: Upload API documentation | |
| if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'PiRogueToolSuite' | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ./doc | |
| deploy-api-doc: | |
| name: Publish documentation on GitHub Pages | |
| if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'PiRogueToolSuite' | |
| needs: generate-openapi-doc | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 | |
| docker-build: | |
| name: Build and publish the docker image | |
| needs: generate-openapi-doc | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| security-events: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Setup Docker buildx | |
| uses: docker/setup-buildx-action@v4 | |
| # Login against a Docker registry except on PR | |
| # https://github.com/docker/login-action | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Extract metadata (tags, labels) for Docker | |
| # https://github.com/docker/metadata-action | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| # generate Docker tags based on the following events/attributes | |
| tags: | | |
| type=schedule | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=sha | |
| # Build and push Docker image with Buildx (don't push on PR) | |
| # https://github.com/docker/build-push-action | |
| - name: Build and push Docker image | |
| id: build-and-push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| # push: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'PiRogueToolSuite' }} | |
| push: ${{ github.event_name != 'pull_request' && github.repository_owner == 'PiRogueToolSuite' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| annotations: | | |
| annotation.org.opencontainers.image.source="https://github.com/PiRogueToolSuite/mandolin" | |
| annotation.org.opencontainers.image.description="Micro-service to analyze and convert files" | |
| annotation.org.opencontainers.image.vendor="Defensive Lab Agency" | |
| annotation.org.opencontainers.image.licenses="GPL-3.0" | |
| annotation.org.opencontainers.image.revision="${{ github.sha }}" | |
| - name: Log into Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Docker Scout | |
| if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'PiRogueToolSuite' | |
| id: docker-scout | |
| uses: docker/scout-action@v1 | |
| with: | |
| command: cves,sbom | |
| image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_METADATA_OUTPUT_VERSION }} | |
| sarif-file: sarif.output.json | |
| summary: true | |
| only-severities: critical,high | |
| write-comment: true | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload SARIF result | |
| if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'PiRogueToolSuite' | |
| id: upload-sarif | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: sarif.output.json |