fix: wrong link in article #4
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: docker | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v*.*.* | |
| - v*.*.*-rc* | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/build.yml | |
| - apps/** | |
| - packages/** | |
| - Dockerfile | |
| - nginx.conf | |
| - pnpm-lock.yaml | |
| - pnpm-workspace.yaml | |
| - '!**/*.md' | |
| workflow_dispatch: | |
| inputs: | |
| push: | |
| type: boolean | |
| default: false | |
| description: "Whether to push the image" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.runner.name }} | |
| strategy: | |
| matrix: | |
| runner: | |
| - name: ubuntu-24.04 | |
| platform: linux/amd64 | |
| - name: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| target: | |
| - website | |
| - docs | |
| - blog | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v5 | |
| - name: set up buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: cache layers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ runner.temp }}/.buildx-cache | |
| key: buildx-${{ runner.arch }}-${{ matrix.target }}-${{ github.sha }} | |
| restore-keys: | | |
| buildx-${{ runner.arch }}-${{ matrix.target }}- | |
| - name: get image metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/ferriskey/ferriskey-${{ matrix.target }} | |
| - name: log-in to ghcr | |
| if: inputs.push || startsWith(github.ref, 'refs/tags/v') || github.ref_name == github.event.repository.default_branch | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: build and push | |
| uses: docker/build-push-action@v6 | |
| id: build | |
| with: | |
| context: . | |
| target: ${{ matrix.target }} | |
| platforms: ${{ matrix.runner.platform }} | |
| tags: ghcr.io/ferriskey/ferriskey-${{ matrix.target }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=local,src=${{ runner.temp }}/.buildx-cache | |
| cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max | |
| outputs: type=image,push-by-digest=true,name-canonical=true,push=${{ inputs.push || startsWith(github.ref, 'refs/tags/v') || github.ref_name == github.event.repository.default_branch }} | |
| - name: prepare digest | |
| id: digest | |
| if: inputs.push || startsWith(github.ref, 'refs/tags/v') || github.ref_name == github.event.repository.default_branch | |
| run: | | |
| mkdir -p ${{ runner.temp }}/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: upload digest | |
| if: inputs.push || startsWith(github.ref, 'refs/tags/v') || github.ref_name == github.event.repository.default_branch | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digests-${{ runner.arch }}-${{ matrix.target }} | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # https://github.com/docker/build-push-action/issues/252 | |
| # https://github.com/moby/buildkit/issues/1896 | |
| - name: move cache | |
| run: | | |
| rm -rf ${{ runner.temp }}/.buildx-cache | |
| mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache | |
| push-manifest: | |
| if: inputs.push || startsWith(github.ref, 'refs/tags/v') || github.ref_name == github.event.repository.default_branch | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - website | |
| - docs | |
| - blog | |
| steps: | |
| - name: set up buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: download digests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-*-${{ matrix.target }} | |
| merge-multiple: true | |
| - name: log-in to ghcr | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: get image metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/ferriskey/ferriskey-${{ matrix.target }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=ref,event=pr | |
| type=sha | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: push manifest | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $(printf 'ghcr.io/ferriskey/ferriskey-${{ matrix.target }}@sha256:%s ' *) |