Skip to content

Build and deploy the toolbox image #76

Build and deploy the toolbox image

Build and deploy the toolbox image #76

name: Build and deploy the toolbox image
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
env:
REGISTRY: ghcr.io
IMAGE_NAME: "righettod/toolbox-codescan"
permissions: read-all
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: List content from checkout
run: ls -rtl
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Update image information file
run: docker image inspect "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main" > image-info.json; git config --global user.email "gha@github.com"; git config --global user.name "GHActionBot"; git commit -m "Sync image information file" image-info.json; git push