Collect additional metadata from scanned Git repositories #200
Workflow file for this run
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
name: Docker | |
on: | |
push: | |
branches: [ "main" ] | |
tags: [ "v*.*.*" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
name: Docker | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
# - uses: docker/setup-qemu-action@v2 # for multi-platform build | |
- uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
tags: noseyparker | |
# platforms: linux/amd64,linux/arm64 | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
labels: | | |
org.opencontainers.image.title=${{ github.event.repository.name }} | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} | |
- name: Test the Docker image | |
run: docker run --rm noseyparker --help | |
- name: Login to github container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push the image to `edge` | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
run: | | |
docker tag noseyparker ghcr.io/${{ github.repository }}:edge | |
docker push ghcr.io/${{ github.repository }}:edge | |
- name: Push the image to `${{ github.ref_name }}` | |
if: github.ref_type == 'tag' | |
run: | | |
docker tag noseyparker ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} | |
- name: Push the image to `latest` | |
if: github.ref_type == 'tag' | |
run: | | |
docker tag noseyparker ghcr.io/${{ github.repository }}:latest | |
docker push ghcr.io/${{ github.repository }}:latest |