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
# Build the mitre_checker python tool as a containerised tool from its | |
# Containerfile lacated at "build/mitre_checker/Containerfile". | |
# Using Kaniko: refer to the following documentations: | |
# * https://github.com/marketplace/actions/kaniko-action | |
# * https://github.com/int128/kaniko-action#inputs | |
name: "Build the mitre_checker tool as a containerised tool and push to GitHub Container Registry (GHCR)" | |
on: | |
pull_request: | |
branches: | |
- main | |
- release/* | |
push: | |
branches: | |
- main | |
- containerfile # Only for testing the github action | |
# Global KANIKO Variables: | |
# See: https://github.com/int128/kaniko-action | |
# - KANIKO_BUILD_CONTEXT is the path to the location of the Containerfile. | |
# - CONTAINERFILE_NAME is name and location of the Containerfile. | |
env: | |
KANIKO_BUILD_CONTEXT: "${{ github.workspace }}/build/mitre_checker" | |
CONTAINERFILE_NAME: "${{ github.workspace }}/build/mitre_checker/Containerfile" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/metadata-action@v3 | |
id: metadata | |
with: | |
images: ghcr.io/${{ github.repository }} | |
- uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: int128/kaniko-action@v1 | |
with: | |
push: true | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
cache: true | |
cache-repository: ghcr.io/${{ github.repository }}/cache | |
file: ${{ env.CONTAINERFILE_NAME }} | |
context: ${{ env.KANIKO_BUILD_CONTEXT }} | |
verbosity: "info" # https://github.com/GoogleContainerTools/kaniko#flag---verbosity |