OSINT commands #28
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 Workflow | |
on: | |
push: | |
tags: ['v*.*.*'] | |
branches: [master] | |
pull_request: | |
branches: [master] | |
workflow_call: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
permissions: | |
contents: read | |
steps: | |
- name: Repository Checkout | |
uses: actions/checkout@v3 | |
- name: Build Docker Image | |
run: docker build . -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
push: | |
name: Build & Push Docker Image | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' || (github.event_name == 'workflow_call' && github.event.inputs.trigger == 'build') | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Repository Checkout | |
uses: actions/checkout@v3 | |
- name: Registry Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Git Metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
- name: Build & Push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |