diff --git a/.github/actions/build-deps/action.yml b/.github/actions/build-deps/action.yml new file mode 100644 index 0000000..d131afc --- /dev/null +++ b/.github/actions/build-deps/action.yml @@ -0,0 +1,42 @@ +name: 'Build Deps' +description: 'Docker Build Deps Images' +inputs: + arch: + description: 'Docker architecture' + required: true + dockerDistro: + description: 'Linux Distro' + required: true + docker_registry: + description: 'Docker Registry' + required: true + docker_registry_name: + description: 'Docker Registry Name' + required: true + docker_registry_username: + description: 'Docker Registry Username' + required: true + docker_registry_password: + description: 'Docker Registry Password' + required: true + push_images: + description: 'Push Images' + required: true + default: 'false' +runs: + using: 'composite' + steps: + - name: Login to ${{ inputs.docker_registry }} + if: ${{ inputs.push_images == 'true' }} + uses: docker/login-action@v3 + with: + registry: ${{ inputs.docker_registry }} + username: ${{ inputs.docker_registry_username }} + password: ${{ inputs.docker_registry_password }} + - name: '[Build Docker images] ${{ inputs.docker_registry }}' + shell: pwsh + run: | + dotnet run/build.dll ` + --target=DockerBuildDeps --arch=${{ matrix.arch }} ` + --dotnet_distro=${{ matrix.distro }} --docker_registry=${{ inputs.docker_registry_name }} ` + --push_images=${{inputs.push_images}} --verbosity=diagnostic diff --git a/.github/workflows/build-deps.yml b/.github/workflows/build-deps.yml index 12fe6ca..fa9ac99 100644 --- a/.github/workflows/build-deps.yml +++ b/.github/workflows/build-deps.yml @@ -79,34 +79,26 @@ jobs: version: 'latest' driver-opts: 'image=moby/buildkit:buildx-stable-1' install: true - - name: Login to DockerHub - if: success() && env.PUSH_IMAGES == 'true' - uses: docker/login-action@v3 + - name: Publish to DockerHub + uses: ./.github/actions/build-deps with: - registry: docker.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: '[Build Docker images] DockerHub' - shell: pwsh - run: | - dotnet run/build.dll ` - --target=DockerBuildDeps --arch=${{ matrix.arch }} ` - --dotnet_distro=${{ matrix.distro }} --docker_registry=dockerhub ` - --push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic - - name: Login to GitHub Container Registry - if: success() && env.PUSH_IMAGES == 'true' - uses: docker/login-action@v3 + arch: ${{ inputs.arch }} + dockerDistro: ${{ matrix.dockerDistro }} + docker_registry: docker.io + docker_registry_name: dockerhub + docker_registry_username: ${{ secrets.DOCKER_USERNAME }} + docker_registry_password: ${{ secrets.DOCKER_PASSWORD }} + push_images: ${{env.PUSH_IMAGES}} + - name: Publish to GitHub Container Registry + uses: ./.github/actions/build-deps with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.DOCKER_GITHUB_TOKEN }} - - name: '[Build Docker images] GitHub' - shell: pwsh - run: | - dotnet run/build.dll ` - --target=DockerBuildDeps --arch=${{ matrix.arch }} ` - --dotnet_distro=${{ matrix.distro }} --docker_registry=github ` - --push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic + arch: ${{ inputs.arch }} + dockerDistro: ${{ matrix.dockerDistro }} + docker_registry: ghcr.io + docker_registry_name: github + docker_registry_username: ${{ github.repository_owner }} + docker_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }} + push_images: ${{env.PUSH_IMAGES}} build_deps_manifests: name: Build Deps Manifests (${{ matrix.distro }})