Skip to content

ci(deps): bump sigstore/cosign-installer from 4.0.0 to 4.1.0 #1914

ci(deps): bump sigstore/cosign-installer from 4.0.0 to 4.1.0

ci(deps): bump sigstore/cosign-installer from 4.0.0 to 4.1.0 #1914

---
name: Docker
on:
push:
pull_request:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
permissions: {}
env:
DOCKER_BUILDKIT: 1
jobs:
docker-build-push:
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
permissions:
# Required to create a release
contents: write
# Required to sign the Docker image
id-token: write
runs-on: ubuntu-latest
steps:
- name: Set IMAGE
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
echo "IMAGE=${GITHUB_REPOSITORY#*/docker-}" >> "${GITHUB_ENV}"
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet # not using .NET
sudo rm -rf /usr/local/lib/android # not building Android
sudo rm -rf /opt/ghc # not using Haskell
docker system prune -af --volumes
sudo apt-get clean
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false
- name: Set SOURCE_DATE_EPOCH
run: |
set -euo pipefail
IFS=$'\n\t'
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "${GITHUB_ENV}"
- if: github.ref == 'refs/heads/main'
uses: sigstore/cosign-installer@ba7bc0a3fef59531c69a25acd34668d6d3fe6f22 # v4.1.0
- uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
id: meta
with:
images: ${{ github.repository_owner }}/${{ env.IMAGE }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Test the Docker image
working-directory: ${{ env.IMAGE }}
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
docker compose -f docker-compose.test.yml run sut
- uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
if: github.ref == 'refs/heads/main'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
id: build
with:
# zizmor: ignore[template-injection] no user input
context: ${{ env.IMAGE }}
platforms: linux/amd64,linux/arm64
pull: true
push: ${{ github.ref == 'refs/heads/main' }}
sbom: true
provenance: mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Sign the Docker image
if: github.ref == 'refs/heads/main'
working-directory: ${{ env.IMAGE }}
env:
DIGEST: ${{ steps.build.outputs.digest }}
TAGS: ${{ steps.meta.outputs.tags }}
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
images=()
for tag in ${TAGS}; do
images+=("${tag}@${DIGEST}")
done
cosign sign --recursive --yes "${images[@]}"
- name: Set VERSION
if: github.ref == 'refs/heads/main'
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
VERSION="$(\grep "${IMAGE}/Dockerfile" -e '^FROM' | \head -n 1 | \sed -e 's/\-[A-Za-z][A-Za-z0-9]*@.*$//; s/^.*://;')"
if [[ "${VERSION}" =~ ^[0-9]+\.[0-9]\.[0-9]+$ ]] ; then
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
elif [[ "${VERSION}" =~ ^[0-9]+\.[0-9]+$ ]] ; then
echo "VERSION=${VERSION}.0" >> "${GITHUB_ENV}"
fi
- name: Check if release already exists
if: env.VERSION != ''
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
id: check-release
with:
script: |
const { VERSION } = process.env
return github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: `v${VERSION}`,
}).then(function(result) {
core.debug(JSON.stringify(result))
core.info(`Release ${result.data.tag_name} found`)
return result.data.tag_name
}).catch(function(error) {
if (error.status === 404) {
core.info(`Release v${VERSION} not found`)
return
} else {
throw error
}
})
result-encoding: string
- name: Trigger Release
if: env.VERSION != '' && steps.check-release.outputs.result == 'undefined'
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
gh release create --generate-notes "v${VERSION}" --title "${VERSION}"