chore(deps): update docker/login-action digest to 4907a6d (#328) #277
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Images to GHCR | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [22, 24] | |
| platform: | |
| - pair: linux/amd64 | |
| runner: ubuntu-latest | |
| slug: linux-amd64 | |
| - pair: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| slug: linux-arm64 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Lowercase image name | |
| run: echo "IMAGE_NAME=${IMAGE_NAME@L}" >> "$GITHUB_ENV" | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 | |
| - name: Extract metadata (labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| github-token: ${{ github.token }} | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7 | |
| with: | |
| context: server | |
| build-args: | | |
| NODE_VERSION=${{ matrix.node }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: ${{ matrix.platform.pair }} | |
| outputs: type=image,"name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}",push-by-digest=true,name-canonical=true,push=true | |
| cache-from: type=gha,scope=build-node${{ matrix.node }}-${{ matrix.platform.slug }} | |
| cache-to: type=gha,scope=build-node${{ matrix.node }}-${{ matrix.platform.slug }},mode=max | |
| - name: Export digest | |
| run: | | |
| set -euo pipefail | |
| mkdir -p "$RUNNER_TEMP/digests" | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "$RUNNER_TEMP/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 | |
| with: | |
| name: digests-node${{ matrix.node }}-${{ matrix.platform.slug }} | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| merge: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node: [22, 24] | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Lowercase image name | |
| run: echo "IMAGE_NAME=${IMAGE_NAME@L}" >> "$GITHUB_ENV" | |
| - name: Download digests | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-node${{ matrix.node }}-* | |
| merge-multiple: true | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| github-token: ${{ github.token }} | |
| flavor: | | |
| latest=auto | |
| suffix=${{ matrix.node != 24 && format('-node{0}', matrix.node) || '' }},onlatest=true | |
| tags: | | |
| type=edge,branch=main | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
| type=sha | |
| - name: Create multi-arch manifest | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| set -euo pipefail | |
| docker buildx imagetools create \ | |
| $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *) | |
| - name: Inspect image | |
| run: | | |
| set -euo pipefail | |
| docker buildx imagetools inspect \ | |
| $(jq -cr '.tags[0]' <<< "$DOCKER_METADATA_OUTPUT_JSON") |