...

Text file src/github.com/docker/distribution/.github/workflows/build.yml

Documentation: github.com/docker/distribution/.github/workflows

     1name: build
     2
     3on:
     4  push:
     5    branches:
     6      - 'release/*'
     7    tags:
     8      - 'v*'
     9  pull_request:
    10
    11env:
    12  DOCKERHUB_SLUG: distribution/distribution
    13
    14jobs:
    15  build:
    16    runs-on: ubuntu-latest
    17    steps:
    18      -
    19        name: Checkout
    20        uses: actions/checkout@v2
    21        with:
    22          fetch-depth: 0
    23      -
    24        name: Docker meta
    25        id: meta
    26        uses: docker/metadata-action@v3
    27        with:
    28          images: |
    29            ${{ env.DOCKERHUB_SLUG }}
    30          ### versioning strategy
    31          ### push semver tag v2.9.0 on main (default branch)
    32          # distribution/distribution:2.9.0
    33          # distribution/distribution:latest
    34          ### push semver tag v2.8.0 on release/2.8 branch
    35          # distribution/distribution:2.8.0
    36          ### push on main
    37          # distribution/distribution:edge
    38          tags: |
    39            type=semver,pattern={{version}}
    40            type=ref,event=pr
    41          # don't create latest tag on release/2.x
    42          flavor: |
    43            latest=false
    44          labels: |
    45            org.opencontainers.image.title=Distribution
    46            org.opencontainers.image.description=The toolkit to pack, ship, store, and deliver container content
    47      -
    48        name: Set up Docker Buildx
    49        uses: docker/setup-buildx-action@v1
    50      -
    51        name: Build artifacts
    52        uses: docker/bake-action@v1
    53        with:
    54          targets: artifact-all
    55      -
    56        name: Move artifacts
    57        run: |
    58          mv ./bin/**/* ./bin/
    59      -
    60        name: Upload artifacts
    61        uses: actions/upload-artifact@v2
    62        with:
    63          name: registry
    64          path: ./bin/*
    65          if-no-files-found: error
    66      -
    67        name: Login to DockerHub
    68        if: github.event_name != 'pull_request'
    69        uses: docker/login-action@v1
    70        with:
    71          username: ${{ secrets.DOCKERHUB_USERNAME }}
    72          password: ${{ secrets.DOCKERHUB_TOKEN }}
    73      -
    74        name: Build image
    75        uses: docker/bake-action@v1
    76        with:
    77          files: |
    78            ./docker-bake.hcl
    79            ${{ steps.meta.outputs.bake-file }}
    80          targets: image-all
    81          push: ${{ startsWith(github.ref, 'refs/tags/') }}
    82      -
    83        name: GitHub Release
    84        uses: softprops/action-gh-release@v1
    85        if: startsWith(github.ref, 'refs/tags/')
    86        with:
    87          draft: true
    88          files: |
    89            bin/*.tar.gz
    90            bin/*.sha256
    91        env:
    92          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View as plain text