Skip to content

Bump anchore/scan-action from 3.2.5 to 5.0.1 #80

Bump anchore/scan-action from 3.2.5 to 5.0.1

Bump anchore/scan-action from 3.2.5 to 5.0.1 #80

Workflow file for this run

name: Build and Publish Docker Image
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
determine-version:
name: "Determine Version"
runs-on: ubuntu-latest
outputs:
semVer: ${{ steps.gitversion.outputs.semVer }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.13
with:
versionSpec: '5.x'
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.13
id: gitversion
with:
useConfigFile: true
docker-build-and-push:
name: "Build and Publish Docker Image"
runs-on: ubuntu-latest
needs: determine-version
env:
SEMVER: ${{ needs.determine-version.outputs.semVer }}
steps:
- name: Set Image Info
run: |
echo "::set-output name=tag::$(date +'%Y-%m-%d')-${{ github.run_number }}"
echo "::set-output name=created::$(date --rfc-3339=seconds | sed 's/ /T/')"
id: image_info
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
- name: Build and export to Docker
uses: docker/build-push-action@v3
with:
load: true
tags: img-template:${{ env.SEMVER }}
- name: Test
run: |
docker run --rm img-template:${{ env.SEMVER }}
docker save img-template:${{ env.SEMVER }} > /tmp/img-template.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: img-template-${{ env.SEMVER }}
path: /tmp/img-template.tar
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v3
with:
platforms: linux/amd64
tags: |
ghcr.io/fr-platform/img-template:latest
ghcr.io/fr-platform/img-template:${{ env.SEMVER }}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ env.SEMVER }}
org.opencontainers.image.created=${{ steps.image_info.outputs.created }}
push: ${{ github.ref == 'refs/heads/main' }}
cache-from: type=gha
cache-to: type=gha,mode=max