Skip to content

chore(deps-dev): update dependency oxfmt to v0.63.0 #3357

chore(deps-dev): update dependency oxfmt to v0.63.0

chore(deps-dev): update dependency oxfmt to v0.63.0 #3357

Workflow file for this run

name: docker publish
on:
push:
branches: [main]
tags: [v*.*.*] # 手動で作成した時用
pull_request:
workflow_call:
inputs:
tag-name:
required: true
type: string
env:
IMAGE_NAME: om
# バージョン指定
# renovate: datasource=github-releases depName=docker/buildx
BUILDX_VERSION: v0.36.1
jobs:
env:
# release-please によるコミットの時は workflow_call でのみ実行する
if: ${{ !( github.workflow == 'docker publish' && startsWith(github.event.head_commit.message, 'release:') && github.event.head_commit.author.name == 'github-actions[bot]' ) }}
runs-on: ubuntu-latest
outputs:
REGISTRY_IMAGE: ${{ steps.lowercase.outputs.REGISTRY_IMAGE }}
PUSH: ${{ github.event_name != 'pull_request' }}
steps:
- id: lowercase
run: |
registory_image='ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}'
echo "REGISTRY_IMAGE=${registory_image@L}" >> $GITHUB_OUTPUT
meta:
needs: [env]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.metadata.outputs.version}}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.labels.outputs.labels }}
json: ${{ steps.metadata.outputs.json }}
steps:
- name: Docker Metadata
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
id: metadata
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},value=${{ inputs.tag-name }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.tag-name }}
type=semver,pattern={{major}},value=${{ inputs.tag-name }},enable=${{ !(startsWith(github.ref, 'refs/tags/v0.') || startsWith(inputs.tag-name, 'v0.')) }}
type=edge,branch=main
- name: Delete org.opencontainers.image.licenses label
id: labels
run: |
cat << EOS >> "$GITHUB_OUTPUT"
labels<<EOF
$(echo '${{ steps.metadata.outputs.labels }}' | sed '/^org.opencontainers.image.licenses=/d')
EOF
EOS
docker-publish:
permissions:
packages: write
needs: [env, meta]
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
on: ubuntu-latest
- platform: linux/arm64
on: ubuntu-24.04-arm
runs-on: ${{ matrix.on }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
with:
version: ${{ env.BUILDX_VERSION }}
- name: Log in to the Container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: build-push
name: Build and push by digest
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: ${{ matrix.platform }}
labels: ${{ needs.meta.outputs.labels }}
outputs: type=image,name=${{ needs.env.outputs.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ fromJson(needs.env.outputs.PUSH) }}
cache-from: type=gha,scope=buildkit-${{ matrix.platform }}
cache-to: type=gha,scope=buildkit-${{ matrix.platform }},mode=max
- if: ${{ github.event_name != 'pull_request' }}
name: Display image digest
env:
NAME: ${{ fromJson(steps.build-push.outputs.metadata)['image.name'] }}
DIGEST: ${{ fromJson(steps.build-push.outputs.metadata)['containerimage.digest'] }}
run: |
name=$(cut --delimiter=',' --fields=1 <<< "$NAME")
echo '```' >> $GITHUB_STEP_SUMMARY
echo "$name@$DIGEST" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- id: export-digest
if: ${{ fromJson(needs.env.outputs.PUSH) }}
name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build-push.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- id: prepare
if: ${{ steps.export-digest.conclusion == 'success' }}
name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_OUTPUT
- if: ${{ steps.export-digest.conclusion == 'success' }}
name: Upload digest
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: digests-${{ steps.prepare.outputs.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
permissions:
packages: write
id-token: write
attestations: write
artifact-metadata: write
needs: [env, meta, docker-publish]
if: ${{ fromJson(needs.env.outputs.PUSH) }}
runs-on: ubuntu-latest
steps:
- name: Download digests
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Log in to the Container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
shell: bash -xe {0}
env:
DOCKER_METADATA_OUTPUT_JSON: ${{ needs.meta.outputs.json }}
run: |
docker buildx imagetools create $(jq -cr '.tags | map("--tag=" + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ needs.env.outputs.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ needs.env.outputs.REGISTRY_IMAGE }}:${{ needs.meta.outputs.version }}
- id: get-image-digest
name: Get image digest
run: |
echo digest=$(docker buildx imagetools inspect ${{ needs.env.outputs.REGISTRY_IMAGE }}:${{ needs.meta.outputs.version }} --format='{{json .Manifest.Digest}}') >> $GITHUB_OUTPUT
- name: Attest Build Provenance
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-name: ${{ needs.env.outputs.REGISTRY_IMAGE }}
subject-digest: ${{ fromJson(steps.get-image-digest.outputs.digest) }}
push-to-registry: true