Skip to content

chore(deps): update anchore/sbom-action action to v0.17.7 (#350) #408

chore(deps): update anchore/sbom-action action to v0.17.7 (#350)

chore(deps): update anchore/sbom-action action to v0.17.7 (#350) #408

name: "release_appmesh_image"
on:
push:
branches:
- main
paths:
- Dockerfile
- .github/workflows/release-appmesh-image.yml
# trigger when the workflow "release_github_package" succeeded
workflow_run:
workflows: ["release_github_package"]
types:
- completed
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: laoshanxi/appmesh
APPMESH_VERSION: "2.1.2"
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Checkout Github code
uses: actions/checkout@v4
# https://docs.docker.com/build/ci/github-actions/multi-platform/
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# 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@v6
with:
context: .
file: Dockerfile
no-cache: true
attests: type=sbom
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.APPMESH_VERSION }}
labels: ${{ steps.meta.outputs.labels }}
- name: Test
uses: addnab/docker-run-action@v3
with:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
shell: bash
run: |
/appmesh-entrypoint.sh &
sleep 5
appc ls