diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 00000000..bc3c498b --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,15 @@ +self-hosted-runner: + # Labels of self-hosted runner in array of strings. + labels: [] +# Configuration variables in array of strings defined in your repository or +# organization. `null` means disabling configuration variables check. +# Empty array means no configuration variable is allowed. +config-variables: + - AGENT_DIR + - AGENT_TOOLS_DIRECTORY + - GH_RUNNER_VERSION + - CHOWN_USER + - LATEST_RELEASE + - IMAGE_NAME + - BASE_IMAGE_SUFFIX + - IMAGE_TAG_PREFIX diff --git a/.github/actions/build-docker/action.yml b/.github/actions/build-docker/action.yml index 4967248f..409913a5 100644 --- a/.github/actions/build-docker/action.yml +++ b/.github/actions/build-docker/action.yml @@ -7,29 +7,35 @@ branding: color: 'blue' inputs: - full_tag: - description: 'full_tag' + gh_runner_version: + description: 'gh_runner_version' required: true - repository_owner: - description: 'repository_owner' + agent_dir: + description: 'agent_dir' required: true - release_image_name: - description: 'release_image_name' + agent_tools_directory: + description: 'agent_tools_directory' required: true - base_build_name: - description: 'base_build_name' + chown_user: + description: 'chown_user' + required: true + image_name: + description: 'image_name' + required: true + base_image_suffix: + description: 'base_image_suffix' required: true - base_build_image: - description: 'base_build_image' + image_tag_prefix: + description: 'image_tag_prefix' required: true - revision: - description: 'revision' + run_number: + description: 'run_number' required: true - tag_prefix: - description: 'tag_prefix' + run_attempt: + description: 'run_attempt' required: true dockerfile: - description: 'dockerfile' + description: 'Dockerfile' required: true matrix_distro: description: 'matrix_distro' @@ -43,9 +49,6 @@ inputs: matrix_docker_codename: description: 'matrix_docker_codename' required: true - chown_user: - description: 'chown_user' - required: true docker_user: description: 'Secret' required: true diff --git a/.github/actions/complex-build-docker/action.yml b/.github/actions/complex-build-docker/action.yml new file mode 100644 index 00000000..776f53fe --- /dev/null +++ b/.github/actions/complex-build-docker/action.yml @@ -0,0 +1,108 @@ +name: 'Action complex build image' +description: "Number of steps to build and deploy image" +author: "DerSkythe" +branding: + icon: 'layers' + color: 'blue' + +inputs: + gh_runner_version: + description: 'gh_runner_version' + required: true + agent_dir: + description: 'agent_dir' + required: true + agent_tools_directory: + description: 'agent_tools_directory' + required: true + chown_user: + description: 'chown_user' + required: true + image_name: + description: 'image_name' + required: true + base_image_suffix: + description: 'base_image_suffix' + required: true + image_tag_prefix: + description: 'image_tag_prefix' + required: true + run_number: + description: 'run_number' + required: true + run_attempt: + description: 'run_attempt' + required: true + dockerfile: + description: 'Dockerfile' + required: true + docker_user: + description: 'secret' + required: true + docker_token: + description: 'Secret' + required: true + gh_token: + description: 'Secret' + required: true +runs: + using: "composite" + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ inputs.docker_user }} + password: ${{ inputs.docker_token }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ inputs.docker_user }} + password: ${{ inputs.gh_token }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + labels: | + org.opencontainers.image.name=${{ inputs.release_image_name }} + org.opencontainers.image.version=${{ inputs.full_tag }} + org.opencontainers.image.base.name=${{ inputs.base_build_image }} + org.opencontainers.image.revision=${{ inputs.revision }} + org.opencontainers.image.licenses=MIT + images: ${{ inputs.image_list }} + flavor: | + latest=false + prefix= + suffix= + tags: | + type=raw,value=${{ inputs.full_tag }},enable=true + type=raw,value=${{ inputs.tag_prefix }},enable=true + + - name: Build and push + if: ${{ success() }} + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfiles/${{ inputs.dockerfile }} + provenance: true + sbom: true + pull: true + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_IMAGE=${{ inputs.base_build_image }} + CHOWN_USER=${{ inputs.chown_user }} + LSB_RELEASE_CODENAME=${{ inputs.matrix_docker_codename }} + DOCKER_CODENAME=${{ inputs.matrix_docker_codename }} + DISTRO=${{ inputs.matrix_distro }} + DISTRO_VERSION=${{ inputs.matrix_version }} + VERSION=${{ env.DOCKER_METADATA_OUTPUT_VERSION }} + REVISION=${{ inputs.revision }} + platforms: ${{ inputs.platforms }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflow-templates/starter-build-workflow.yml b/.github/workflow-templates/starter-build-workflow.yml new file mode 100644 index 00000000..8fbe03e2 --- /dev/null +++ b/.github/workflow-templates/starter-build-workflow.yml @@ -0,0 +1,129 @@ +name: "Builder CI" + +on: + push: + branches: [ $default-branch ] + branches-ignore: [ 'dev', 'builder' ] + pull: + branches: [ $default-branch ] + branches-ignore: [ 'dev', 'builder' ] + workflow_dispatch: + +concurrency: + group: base-builder-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true + +env: + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} + BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} + REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} + FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} + # All Dockerfiles must be in ./Dockerfiles/ + +jobs: + base-make: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] + include: + - os: ubuntu-jammy + distro: ubuntu + codename: jammy + docker-codename: jammy + distro-version: 22.04 + - os: ubuntu-focal + distro: ubuntu + codename: focal + docker-codename: focal + distro-version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + codename: bionic + docker-codename: bionic + distro-version: 18.04 + - os: debian-bullseye + distro: debian + codename: bullseye + docker-codename: bullseye + distro-version: 11 + - os: debian-sid + distro: debian + codename: sid + docker-codename: bullseye + distro-version: 10 + environment: + name: Builder + env: + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} + BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} + REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} + FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} + # All Dockerfiles must be in ./Dockerfiles/ + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + + - name: BUILD ${{ env.RELEASE_IMAGE_NAME }} + if: ${{ env.RELEASE_IMAGE_NAME != '-' }} + uses: ./.github/actions/build-docker + with: + full_tag: ${{ env.FULL_TAG }} + repository_owner: ${{ env.REPOSITORY_OWNER }} + release_image_name: ${{ env.RELEASE_IMAGE_NAME }} + base_name: ${{ env.BASE_IMAGE_NAME }} + base_build_image: ${{ env.BASE_BUILD_IMAGE }} + revision: ${{ env.REVISION }} + tag_prefix: ${{ env.TAG_PREFIX }} + dockerfile: ${{ env.DOCKER_FILE }} + matrix_distro: ${{ matrix.distro }} + matrix_codename: ${{matrix.codename}} + matrix_version: ${{ matrix.distro-version }} + matrix_docker_codename: ${{ matrix.docker-codename}} + chown_user: ${{env.CHOWN_USER }} + docker_user: ${{ secrets.DOCKER_USER }} + docker_token: ${{ secrets.DOCKER_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 + image_list: | + ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + + update-dockerhub-info: + runs-on: ubuntu-latest + needs: base-make + environment: + name: Builder + env: + REPOSITORY_OWNER: ${{ github.repository_owner }} + if: ${{ success() }} + steps: + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + repository: ${{ github.repository }} + short-description: ${{ github.event.repository.description }} + readme-filepath: './README_BUILD.md' +#EOF diff --git a/.github/workflows/build-base-all-included.yml b/.github/workflows/build-base-all-included.yml new file mode 100644 index 00000000..17390d7e --- /dev/null +++ b/.github/workflows/build-base-all-included.yml @@ -0,0 +1,127 @@ +name: "Base ALL_INCLUDED build" +run-name: "Base ALL_INCLUDED build «${{ github.ref_name }}» λ${{ github.event_name }}" + +on: + workflow_dispatch: + push: + branches: dotnet + paths: + - Dockerfile* + - .github/workflows/build-base-all-included.yml + +concurrency: + group: all-included-base-build + cancel-in-progress: true + +env: + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + +jobs: + pre-build: + runs-on: ubuntu-latest + environment: + name: AllIncluded + env: + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + BASE_IMAGE_SUFFIX: ${{ vars.BASE_IMAGE_SUFFIX }} + IMAGE_TAG_PREFIX: ${{ vars.image_tag_prefix }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + IMAGE_NAME: ${{ vars.IMAGE_NAME }} + RUN_NUMBER: ${{ github.RUN_NUMBER }} + RUN_ATTEMPT: ${{ github.RUN_ATTEMPT }} + # All Dockerfiles must be in ./Dockerfiles/ + defaults: + run: + shell: pwsh + outputs: + outvar: ${{ steps.last.outputs.RELEASE_VERSION }} + permissions: + contents: write + packages: write + steps: + - + name: Checkout code + uses: actions/checkout@v3 + + - name: Set version by default + shell: pwsh + run: | + Write-Output 'PREFIX=${{ matrix.os }}' >> $env:GITHUB_ENV + Write-Output 'REVISION=${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}' >> $env:GITHUB_ENV + Write-Output 'FULL_TAG=${{ matrix.os }}-${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}' >> $env:GITHUB_ENV + Write-Output 'BASE_BUILD_IMAGE=${{ matrix.distro }}:${{ matrix.codename }}' >> $env:GITHUB_ENV + Write-Output 'RELEASE_IMAGE_NAME=${{ vars.RELEASE_IMAGE_NAME }}-base' >> $env:GITHUB_ENV + if( [string]::IsNullOrWhitespace('${{ matrix.dockerfile }}') ) + { + Write-Output 'DOCKERFILE=Dockerfile.base' >> $env:GITHUB_ENV + } + else + { + Write-Output 'DOCKERFILE=${{ matrix.dockerfile }}' >> $env:GITHUB_ENV + } + + run-build-workflow: + concurrency: + group: run-build-workflow + cancel-in-progress: true + uses: derskythe/docker-github-actions-runner/.github/workflows/reusable/reusable-docker.yml@feat/change-naming + with: + env_vars: | + agent_dir: ${{ vars.AGENT_DIR }} + agent_tools_directory: ${{ vars.AGENT_TOOLS_DIRECTORY }} + chown_user: ${{ vars.CHOWN_USER }} + image_name: ${{ vars.IMAGE_NAME }} + base_image_suffix: ${{ vars.BASE_IMAGE_SUFFIX }} + image_tag_prefix: ${{ vars.IMAGE_TAG_PREFIX }} + run_number: ${{ github.RUN_NUMBER }} + run_attempt: ${{ github.RUN_ATTEMPT }} + +# secrets: + # token: ${{ secrets.GITHUB_TOKEN }} + # docker-user: ${{ secrets.DOCKER_USER }} + # docker-token: ${{ secrets.DOCKER_TOKEN }} + + # - name: BUILD ${{ env.BASE_IMAGE_SUFFIX }} + # if: ${{ env.IMAGE_TAG_PREFIX != '-' }} + # uses: ./.github/actions/build-docker + # with: + # full_tag: ${{ env.FULL_TAG }} + # repository_owner: ${{ env.REPOSITORY_OWNER }} + # release_image_name: ${{ env.RELEASE_IMAGE_NAME }} + # base_name: ${{ env.BASE_IMAGE_NAME }} + # base_build_image: ${{ env.BASE_BUILD_IMAGE }} + # revision: ${{ env.REVISION }} + # tag_prefix: ${{ env.TAG_PREFIX }} + # dockerfile: ${{ env.DOCKER_FILE }} + # matrix_distro: ${{ matrix.distro }} + # matrix_codename: ${{matrix.codename}} + # matrix_version: ${{ matrix.distro-version }} + # matrix_docker_codename: ${{ matrix.docker-codename}} + # chown_user: ${{env.CHOWN_USER }} + # docker_user: ${{ secrets.DOCKER_USER }} + # docker_token: ${{ secrets.DOCKER_TOKEN }} + # gh_token: ${{ secrets.GITHUB_TOKEN }} + # platforms: linux/amd64,linux/arm64 + # image_list: | + # ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + # ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + + # update-dockerhub-info: + # runs-on: ubuntu-latest + # needs: base-make + # environment: + # name: Builder + # env: + # REPOSITORY_OWNER: ${{ github.repository_owner }} + # if: ${{ success() }} + # steps: + # - name: Docker Hub Description + # uses: peter-evans/dockerhub-description@v3 + # with: + # username: ${{ secrets.DOCKER_USER }} + # password: ${{ secrets.DOCKER_TOKEN }} + # repository: ${{ github.repository }} + # short-description: ${{ github.event.repository.description }} + # readme-filepath: ${{ format('./README_.md', env.BASE_IMAGE_SUFFIX) }} +#EOF diff --git a/.github/workflows/build-base-build.yml b/.github/workflows/build-base-build.yml new file mode 100644 index 00000000..766c3ca3 --- /dev/null +++ b/.github/workflows/build-base-build.yml @@ -0,0 +1,118 @@ +name: "Base BUILDER" +run-name: "Base BUILDER «${{ github.ref_name }}» λ${{ github.event_name }}" + +on: + workflow_dispatch: + push: + # branches: dev + paths: + - .github/workflows/build-base-build.yml +# schedule: +# - cron: "0 */6 * * *" +# branches: +# - master +# - develop + +concurrency: + group: base-builder + cancel-in-progress: true + +env: + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + +jobs: + base-make: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] + include: + - os: ubuntu-jammy + distro: ubuntu + codename: jammy + docker-codename: jammy + distro-version: 22.04 + - os: ubuntu-focal + distro: ubuntu + codename: focal + docker-codename: focal + distro-version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + codename: bionic + docker-codename: bionic + distro-version: 18.04 + - os: debian-bullseye + distro: debian + codename: bullseye + docker-codename: bullseye + distro-version: 11 + - os: debian-sid + distro: debian + codename: sid + docker-codename: bullseye + distro-version: 10 + environment: + name: Builder + env: + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} + BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} + REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} + FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} + # All Dockerfiles must be in ./Dockerfiles/ + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + + - name: BUILD ${{ env.RELEASE_IMAGE_NAME }} + if: ${{ env.RELEASE_IMAGE_NAME != '-' }} + uses: ./.github/actions/build-docker + with: + full_tag: ${{ env.FULL_TAG }} + repository_owner: ${{ env.REPOSITORY_OWNER }} + release_image_name: ${{ env.RELEASE_IMAGE_NAME }} + base_name: ${{ env.BASE_IMAGE_NAME }} + base_build_image: ${{ env.BASE_BUILD_IMAGE }} + revision: ${{ env.REVISION }} + tag_prefix: ${{ env.TAG_PREFIX }} + dockerfile: ${{ env.DOCKER_FILE }} + matrix_distro: ${{ matrix.distro }} + matrix_codename: ${{matrix.codename}} + matrix_version: ${{ matrix.distro-version }} + matrix_docker_codename: ${{ matrix.docker-codename}} + chown_user: ${{env.CHOWN_USER }} + docker_user: ${{ secrets.DOCKER_USER }} + docker_token: ${{ secrets.DOCKER_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 + image_list: | + ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + + update-dockerhub-info: + runs-on: ubuntu-latest + needs: base-make + environment: + name: Builder + env: + REPOSITORY_OWNER: ${{ github.repository_owner }} + if: ${{ success() }} + steps: + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + repository: ${{ github.repository }} + short-description: ${{ github.event.repository.description }} + readme-filepath: './README_BUILD.md' +#EOF diff --git a/.github/workflows/build-base-dev.yml b/.github/workflows/build-base-dev.yml index f115c90a..f33044f9 100644 --- a/.github/workflows/build-base-dev.yml +++ b/.github/workflows/build-base-dev.yml @@ -1,116 +1,119 @@ -name: "DEV BASE build" -run-name: "Build DEV-BASE ${{ github.ref_name }} by ${{ github.event_name }}" -# TODO: MUST BE RENAMED TO BUILD IN FUTURE! -on: - workflow_dispatch: - push: - branches: dev - paths: - - Dockerfile* - - .github/workflows/build-base-dev.yml -# schedule: -# - cron: "0 */6 * * *" -# branches: -# - master -# - develop - -concurrency: - group: dev-base-image-make - cancel-in-progress: true - -jobs: - base-make: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - os: - [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] - include: - - os: ubuntu-jammy - distro: ubuntu - codename: jammy - docker-codename: jammy - distro-version: 22.04 - - os: ubuntu-focal - distro: ubuntu - codename: focal - docker-codename: focal - distro-version: 20.04 - - os: ubuntu-bionic - distro: ubuntu - codename: bionic - docker-codename: bionic - distro-version: 18.04 - - os: debian-bullseye - distro: debian - codename: bullseye - docker-codename: bullseye - distro-version: 11 - - os: debian-sid - distro: debian - codename: sid - docker-codename: bullseye - distro-version: 10 - environment: - name: Builder - env: - AGENT_DIR: ${{ vars.AGENT_DIR }} - AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} - GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} - CHOWN_USER: ${{ vars.CHOWN_USER }} - BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} - RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} - BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} - TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} - REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} - FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} - REPOSITORY_OWNER: ${{ github.repository_owner }} - DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} - steps: - - name: Copy Repo Files - uses: actions/checkout@v3 - - - name: BUILD ${{ env.RELEASE_IMAGE_NAME }} - if: ${{ env.RELEASE_IMAGE_NAME != '-' }} - uses: ./.github/actions/build-docker - with: - full_tag: ${{ env.FULL_TAG }} - repository_owner: ${{ env.REPOSITORY_OWNER }} - release_image_name: ${{ env.RELEASE_IMAGE_NAME }} - base_name: ${{ env.BASE_IMAGE_NAME }} - base_build_image: ${{ env.BASE_BUILD_IMAGE }} - revision: ${{ env.REVISION }} - tag_prefix: ${{ env.TAG_PREFIX }} - dockerfile: ${{ env.DOCKER_FILE }} - matrix_distro: ${{ matrix.distro }} - matrix_codename: ${{matrix.codename}} - matrix_version: ${{ matrix.distro-version }} - matrix_docker_codename: ${{ matrix.docker-codename}} - chown_user: ${{env.CHOWN_USER }} - docker_user: ${{ secrets.DOCKER_USER }} - docker_token: ${{ secrets.DOCKER_TOKEN }} - gh_token: ${{ secrets.GITHUB_TOKEN }} - platforms: linux/amd64,linux/arm64 - image_list: | - ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} - ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} - - update-dockerhub-info: - runs-on: ubuntu-latest - needs: base-make - environment: - name: Builder - env: - REPOSITORY_OWNER: ${{ github.repository_owner }} - if: ${{ success() }} - steps: - - name: Docker Hub Description - uses: peter-evans/dockerhub-description@v3 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_TOKEN }} - repository: ${{ github.repository }} - short-description: ${{ github.event.repository.description }} - readme-filepath: './README_BUILD.md' -#EOF +name: "Base DEV build" +run-name: "Base DEV build «${{ github.ref_name }}» λ${{ github.event_name }}" +# NOTE: Dev configuration must watch dev branch +on: + workflow_dispatch: + push: + branches: dev + paths: + - Dockerfile* + - .github/workflows/build-base-dev.yml +# schedule: +# - cron: "0 */6 * * *" +# branches: +# - master +# - develop + +concurrency: + group: base-dev-build + cancel-in-progress: true + +env: + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + +jobs: + base-make: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] + include: + - os: ubuntu-jammy + distro: ubuntu + codename: jammy + docker-codename: jammy + distro-version: 22.04 + - os: ubuntu-focal + distro: ubuntu + codename: focal + docker-codename: focal + distro-version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + codename: bionic + docker-codename: bionic + distro-version: 18.04 + - os: debian-bullseye + distro: debian + codename: bullseye + docker-codename: bullseye + distro-version: 11 + - os: debian-sid + distro: debian + codename: sid + docker-codename: bullseye + distro-version: 10 + environment: + name: Dev + env: + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} + BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} + REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} + FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} + # All Dockerfiles must be in ./Dockerfiles/ + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + + - name: BUILD ${{ env.RELEASE_IMAGE_NAME }} + if: ${{ env.RELEASE_IMAGE_NAME != '-' }} + uses: ./.github/actions/build-docker + with: + full_tag: ${{ env.FULL_TAG }} + repository_owner: ${{ env.REPOSITORY_OWNER }} + release_image_name: ${{ env.RELEASE_IMAGE_NAME }} + base_name: ${{ env.BASE_IMAGE_NAME }} + base_build_image: ${{ env.BASE_BUILD_IMAGE }} + revision: ${{ env.REVISION }} + tag_prefix: ${{ env.TAG_PREFIX }} + dockerfile: ${{ env.DOCKER_FILE }} + matrix_distro: ${{ matrix.distro }} + matrix_codename: ${{matrix.codename}} + matrix_version: ${{ matrix.distro-version }} + matrix_docker_codename: ${{ matrix.docker-codename}} + chown_user: ${{env.CHOWN_USER }} + docker_user: ${{ secrets.DOCKER_USER }} + docker_token: ${{ secrets.DOCKER_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 + image_list: | + ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + + update-dockerhub-info: + runs-on: ubuntu-latest + needs: base-make + environment: + name: Dev + env: + REPOSITORY_OWNER: ${{ github.repository_owner }} + if: ${{ success() }} + steps: + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + repository: ${{ github.repository }} + short-description: ${{ github.event.repository.description }} + readme-filepath: './README_BUILD.md' +#EOF diff --git a/.github/workflows/build-base-dotnet.yml b/.github/workflows/build-base-dotnet.yml new file mode 100644 index 00000000..5242a1a3 --- /dev/null +++ b/.github/workflows/build-base-dotnet.yml @@ -0,0 +1,117 @@ +name: "DEV BASE build" +run-name: "Build DEV-BASE «${{ github.ref_name }}» λ${{ github.event_name }}" +# TODO: MUST BE RENAMED TO BUILD IN FUTURE! +on: + workflow_dispatch: + push: + branches: dev + paths: + - Dockerfile* + - .github/workflows/build-base-dev.yml +# schedule: +# - cron: "0 */6 * * *" +# branches: +# - master +# - develop + +concurrency: + group: dev-base-image-make + cancel-in-progress: true + +jobs: + base-make: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] + include: + - os: ubuntu-jammy + distro: ubuntu + codename: jammy + docker-codename: jammy + distro-version: 22.04 + - os: ubuntu-focal + distro: ubuntu + codename: focal + docker-codename: focal + distro-version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + codename: bionic + docker-codename: bionic + distro-version: 18.04 + - os: debian-bullseye + distro: debian + codename: bullseye + docker-codename: bullseye + distro-version: 11 + - os: debian-sid + distro: debian + codename: sid + docker-codename: bullseye + distro-version: 10 + environment: + name: Builder + env: + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} + BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} + REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} + FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} + # All Dockerfiles must be in ./Dockerfiles/ + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + + - name: BUILD ${{ env.RELEASE_IMAGE_NAME }} + if: ${{ env.RELEASE_IMAGE_NAME != '-' }} + uses: ./.github/actions/build-docker + with: + full_tag: ${{ env.FULL_TAG }} + repository_owner: ${{ env.REPOSITORY_OWNER }} + release_image_name: ${{ env.RELEASE_IMAGE_NAME }} + base_name: ${{ env.BASE_IMAGE_NAME }} + base_build_image: ${{ env.BASE_BUILD_IMAGE }} + revision: ${{ env.REVISION }} + tag_prefix: ${{ env.TAG_PREFIX }} + dockerfile: ${{ env.DOCKER_FILE }} + matrix_distro: ${{ matrix.distro }} + matrix_codename: ${{matrix.codename}} + matrix_version: ${{ matrix.distro-version }} + matrix_docker_codename: ${{ matrix.docker-codename}} + chown_user: ${{env.CHOWN_USER }} + docker_user: ${{ secrets.DOCKER_USER }} + docker_token: ${{ secrets.DOCKER_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 + image_list: | + ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + + update-dockerhub-info: + runs-on: ubuntu-latest + needs: base-make + environment: + name: Builder + env: + REPOSITORY_OWNER: ${{ github.repository_owner }} + if: ${{ success() }} + steps: + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + repository: ${{ github.repository }} + short-description: ${{ github.event.repository.description }} + readme-filepath: './README_BUILD.md' +#EOF diff --git a/.github/workflows/build-base-edge.yml b/.github/workflows/build-base-edge.yml new file mode 100644 index 00000000..5242a1a3 --- /dev/null +++ b/.github/workflows/build-base-edge.yml @@ -0,0 +1,117 @@ +name: "DEV BASE build" +run-name: "Build DEV-BASE «${{ github.ref_name }}» λ${{ github.event_name }}" +# TODO: MUST BE RENAMED TO BUILD IN FUTURE! +on: + workflow_dispatch: + push: + branches: dev + paths: + - Dockerfile* + - .github/workflows/build-base-dev.yml +# schedule: +# - cron: "0 */6 * * *" +# branches: +# - master +# - develop + +concurrency: + group: dev-base-image-make + cancel-in-progress: true + +jobs: + base-make: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] + include: + - os: ubuntu-jammy + distro: ubuntu + codename: jammy + docker-codename: jammy + distro-version: 22.04 + - os: ubuntu-focal + distro: ubuntu + codename: focal + docker-codename: focal + distro-version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + codename: bionic + docker-codename: bionic + distro-version: 18.04 + - os: debian-bullseye + distro: debian + codename: bullseye + docker-codename: bullseye + distro-version: 11 + - os: debian-sid + distro: debian + codename: sid + docker-codename: bullseye + distro-version: 10 + environment: + name: Builder + env: + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} + BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} + REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} + FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} + # All Dockerfiles must be in ./Dockerfiles/ + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + + - name: BUILD ${{ env.RELEASE_IMAGE_NAME }} + if: ${{ env.RELEASE_IMAGE_NAME != '-' }} + uses: ./.github/actions/build-docker + with: + full_tag: ${{ env.FULL_TAG }} + repository_owner: ${{ env.REPOSITORY_OWNER }} + release_image_name: ${{ env.RELEASE_IMAGE_NAME }} + base_name: ${{ env.BASE_IMAGE_NAME }} + base_build_image: ${{ env.BASE_BUILD_IMAGE }} + revision: ${{ env.REVISION }} + tag_prefix: ${{ env.TAG_PREFIX }} + dockerfile: ${{ env.DOCKER_FILE }} + matrix_distro: ${{ matrix.distro }} + matrix_codename: ${{matrix.codename}} + matrix_version: ${{ matrix.distro-version }} + matrix_docker_codename: ${{ matrix.docker-codename}} + chown_user: ${{env.CHOWN_USER }} + docker_user: ${{ secrets.DOCKER_USER }} + docker_token: ${{ secrets.DOCKER_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 + image_list: | + ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + + update-dockerhub-info: + runs-on: ubuntu-latest + needs: base-make + environment: + name: Builder + env: + REPOSITORY_OWNER: ${{ github.repository_owner }} + if: ${{ success() }} + steps: + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + repository: ${{ github.repository }} + short-description: ${{ github.event.repository.description }} + readme-filepath: './README_BUILD.md' +#EOF diff --git a/.github/workflows/build-base-legacy.yml b/.github/workflows/build-base-legacy.yml new file mode 100644 index 00000000..5242a1a3 --- /dev/null +++ b/.github/workflows/build-base-legacy.yml @@ -0,0 +1,117 @@ +name: "DEV BASE build" +run-name: "Build DEV-BASE «${{ github.ref_name }}» λ${{ github.event_name }}" +# TODO: MUST BE RENAMED TO BUILD IN FUTURE! +on: + workflow_dispatch: + push: + branches: dev + paths: + - Dockerfile* + - .github/workflows/build-base-dev.yml +# schedule: +# - cron: "0 */6 * * *" +# branches: +# - master +# - develop + +concurrency: + group: dev-base-image-make + cancel-in-progress: true + +jobs: + base-make: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] + include: + - os: ubuntu-jammy + distro: ubuntu + codename: jammy + docker-codename: jammy + distro-version: 22.04 + - os: ubuntu-focal + distro: ubuntu + codename: focal + docker-codename: focal + distro-version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + codename: bionic + docker-codename: bionic + distro-version: 18.04 + - os: debian-bullseye + distro: debian + codename: bullseye + docker-codename: bullseye + distro-version: 11 + - os: debian-sid + distro: debian + codename: sid + docker-codename: bullseye + distro-version: 10 + environment: + name: Builder + env: + AGENT_DIR: ${{ vars.AGENT_DIR }} + AGENT_TOOLS_DIRECTORY: ${{ vars.AGENT_TOOLS_DIRECTORY }} + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + CHOWN_USER: ${{ vars.CHOWN_USER }} + BASE_IMAGE_NAME: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + RELEASE_IMAGE_NAME: ${{ format ('{0}-{1}', vars.IMAGE_NAME, vars.BASE_IMAGE_SUFFIX) }} + BASE_BUILD_IMAGE: ${{ format('{0}:{1}', matrix.distro, matrix.codename) }} + TAG_PREFIX: ${{ format('{0}-{1}', vars.IMAGE_TAG_PREFIX, matrix.os) }} + REVISION: ${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }} + FULL_TAG: ${{ format('{0}-{1}-{2}.{3}', vars.IMAGE_TAG_PREFIX, matrix.os, github.RUN_NUMBER, github.RUN_ATTEMPT) }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + DOCKER_FILE: ${{ format('Dockerfile.{0}-{1}', vars.BASE_IMAGE_SUFFIX, vars.IMAGE_TAG_PREFIX) }} + # All Dockerfiles must be in ./Dockerfiles/ + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + + - name: BUILD ${{ env.RELEASE_IMAGE_NAME }} + if: ${{ env.RELEASE_IMAGE_NAME != '-' }} + uses: ./.github/actions/build-docker + with: + full_tag: ${{ env.FULL_TAG }} + repository_owner: ${{ env.REPOSITORY_OWNER }} + release_image_name: ${{ env.RELEASE_IMAGE_NAME }} + base_name: ${{ env.BASE_IMAGE_NAME }} + base_build_image: ${{ env.BASE_BUILD_IMAGE }} + revision: ${{ env.REVISION }} + tag_prefix: ${{ env.TAG_PREFIX }} + dockerfile: ${{ env.DOCKER_FILE }} + matrix_distro: ${{ matrix.distro }} + matrix_codename: ${{matrix.codename}} + matrix_version: ${{ matrix.distro-version }} + matrix_docker_codename: ${{ matrix.docker-codename}} + chown_user: ${{env.CHOWN_USER }} + docker_user: ${{ secrets.DOCKER_USER }} + docker_token: ${{ secrets.DOCKER_TOKEN }} + gh_token: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 + image_list: | + ${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + ghcr.io/${{ env.REPOSITORY_OWNER }}/${{ env.RELEASE_IMAGE_NAME }} + + update-dockerhub-info: + runs-on: ubuntu-latest + needs: base-make + environment: + name: Builder + env: + REPOSITORY_OWNER: ${{ github.repository_owner }} + if: ${{ success() }} + steps: + - name: Docker Hub Description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + repository: ${{ github.repository }} + short-description: ${{ github.event.repository.description }} + readme-filepath: './README_BUILD.md' +#EOF diff --git a/.github/workflows/build-base.yml b/.github/workflows/build-base.yml index 63f1f068..2c93b78d 100644 --- a/.github/workflows/build-base.yml +++ b/.github/workflows/build-base.yml @@ -1,13 +1,12 @@ name: "BASE build" -run-name: "Build BASE ${{ github.ref_name }} by ${{ github.event_name }}" - +run-name: "Build BASE «${{ github.ref_name }}» λ${{ github.event_name }}" +# This YAML is obsolete +# TODO: Remove this on: workflow_dispatch: push: branches: dotnet paths: - - Dockerfile.base - - Dockerfile.base-slim - .github/workflows/build-base.yml schedule: - cron: "0 */6 * * *" diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 49a476ee..4c2b40ff 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -1,238 +1,238 @@ -name: "Action Runner Image build" -run-name: "Action Runner Image build ${{ github.ref_name }} by ${{ github.event_name }}" -on: - workflow_dispatch: - push: - branches: dotnet - paths: - - "build-image.yml" - - "Dockerfile" - - 'Dockerfile.dotnet' - workflow_run: - workflows: [BASE build, RELEASE update] - types: [completed] - -permissions: - contents: read - packages: write - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -jobs: - pull-build-push: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} - strategy: - fail-fast: false - matrix: - os: - [ ubuntu-jammy, ubuntu-jammy-dotnet, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid, debian-bullseye-dotnet, ] - include: - - os: ubuntu-jammy - distro: ubuntu - distro-version: 22.04 - has-latest: true - - os: ubuntu-jammy-dotnet - distro: ubuntu - distro-version: 22.04 - dockerfile: Dockerfile.dotnet - - os: ubuntu-focal - distro: ubuntu - distro-version: 20.04 - - os: ubuntu-bionic - distro: ubuntu - distro-version: 18.04 - - os: debian-bullseye - distro: debian - distro-version: 11 - - os: debian-sid - distro: debian - distro-version: 10 - - os: debian-bullseye-dotnet - dockerfile: Dockerfile.dotnet - distro: debian - distro-version: 11 - steps: - - name: Copy Repo Files - uses: actions/checkout@v3 - - name: Set version by default - shell: pwsh - run: | - Write-Output 'PREFIX=${{ matrix.os }}' >> $env:GITHUB_ENV - Write-Output 'REVISION=${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}' >> $env:GITHUB_ENV - Write-Output 'RELEASE_VERSION=${{ vars.GH_RUNNER_VERSION }}' >> $env:GITHUB_ENV - Write-Output 'FULL_TAG=${{ matrix.os }}-${{ vars.GH_RUNNER_VERSION }}-${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}' >> $env:GITHUB_ENV - Write-Output 'BASE_BUILD_IMAGE=${{ vars.RELEASE_IMAGE_NAME }}-base:${{ matrix.os }}' >> $env:GITHUB_ENV - Write-Output 'RELEASE_IMAGE_NAME=${{ vars.RELEASE_IMAGE_NAME }}' >> $env:GITHUB_ENV - $LatestFlag = ([string]::IsNullOrWhitespace('${{ matrix.has-latest }}') ? 'false' : 'true') - Write-Output "LATEST_FLAG=$LatestFlag" >> $env:GITHUB_ENV - if( [string]::IsNullOrWhitespace('${{ matrix.dockerfile }}') ) - { - Write-Output 'DOCKERFILE=Dockerfile' >> $env:GITHUB_ENV - } - else - { - Write-Output 'DOCKERFILE=${{ matrix.dockerfile }}' >> $env:GITHUB_ENV - } - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.ACTOR }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - labels: | - org.opencontainers.image.name=${{ github.ACTOR }}/${{ env.RELEASE_IMAGE_NAME }} - org.opencontainers.image.version=${{ env.FULL_TAG }} - org.opencontainers.image.base.name=${{ github.ACTOR }}/${{ env.BASE_BUILD_IMAGE }} - org.opencontainers.image.revision=${{ env.REVISION }} - org.opencontainers.image.licenses=MIT - images: | - ${{ github.ACTOR }}/${{ env.RELEASE_IMAGE_NAME }} - ghcr.io/${{ github.ACTOR }}/${{ env.RELEASE_IMAGE_NAME }} - flavor: | - latest=false - prefix= - suffix= - tags: | - type=raw,value=${{ env.PREFIX }},enable=true - type=raw,value=${{ env.FULL_TAG }},enable=true - type=raw,value=latest,enable=${{ env.LATEST_FLAG }} - type=raw,value=${{ env.PREFIX }}-latest,enable=${{ env.LATEST_FLAG }} - type=raw,value=${{ env.RELEASE_VERSION }},enable=${{ env.LATEST_FLAG }} - - name: Build and push - uses: docker/build-push-action@v4 - with: - context: . - file: ${{ env.DOCKERFILE }} - provenance: true - sbom: true - pull: true - push: true - #push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: | - BASE_IMAGE=${{ github.ACTOR }}/${{ env.BASE_BUILD_IMAGE }} - CHOWN_USER=${{ vars.CHOWN_USER }} - DISTRO=${{ matrix.distro }} - DISTRO_VERSION=${{ matrix.distro-version }} - GH_RUNNER_VERSION=${{ vars.GH_RUNNER_VERSION }} - BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} - VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} - REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} - platforms: linux/amd64,linux/arm64 - cache-from: type=gha - cache-to: type=gha,mode=max - - # build_base_slim: - # runs-on: ubuntu-latest - # #if: ${{ 1 == 2 }} - # #if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event_name == 'workflow_dispatch' }} - # strategy: - # fail-fast: false - # matrix: - # os: [ debian-bullseye, ubuntu-jammy ] - # include: - # - - # os: debian-bullseye - # os-tag: debian:bullseye-slim - # distro: debian - # distro-version: bullseye - # docker-distro-version: bullseye - # - - # os: ubuntu-jammy - # os-tag: ubuntu:jammy - # distro: ubuntu - # distro-version: jammy - # docker-distro-version: jammy - # steps: - # - - # name: Set version prefix - # run: | - # echo "PREFIX_VERSION=${{ matrix.os }}-slim" >> $GITHUB_ENV - # echo "VERSION_NUMBER=${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}" >> $GITHUB_ENV - # - - # name: Copy Repo Files - # uses: actions/checkout@v3 - # - - # name: Set up QEMU - # uses: docker/setup-qemu-action@v2 - # - - # name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 - # - - # name: Login to DockerHub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_USER }} - # password: ${{ secrets.DOCKER_TOKEN }} - # - - # name: Login to GitHub Container Registry - # uses: docker/login-action@v2 - # with: - # registry: ghcr.io - # username: ${{ github.ACTOR }} - # password: ${{ secrets.GITHUB_TOKEN }} - # - - # name: Docker meta - # id: meta - # uses: docker/metadata-action@v4 - # with: - # labels: | - # org.opencontainers.image.name=${{ vars.BASE_IMAGE }} - # org.opencontainers.image.version=${{ env.PREFIX_VERSION }}-${{ env.VERSION_NUMBER }} - # org.opencontainers.image.base.name=${{ matrix.os-tag }} - # org.opencontainers.image.revision=${{ env.VERSION_NUMBER }} - # org.opencontainers.image.licenses=MIT - # images: | - # ${{ vars.BASE_IMAGE }} - # ghcr.io/${{ vars.BASE_IMAGE }} - # flavor: | - # latest=false - # prefix= - # suffix= - # tags: | - # type=schedule,enable=true,priority=1000,prefix=,suffix=,pattern=nightly-{{raw}} - # type=raw,value=${{ env.PREFIX_VERSION }}-${{ env.VERSION_NUMBER }},enable=true - # type=raw,value=${{ env.PREFIX_VERSION }},enable=true - # type=raw,value=${{ env.PREFIX_VERSION }}-latest,enable=true - # - - # name: Build and push - # uses: docker/build-push-action@v4 - # with: - # context: . - # file: Dockerfile.base-slim - # provenance: true - # sbom: true - # pull: true - # push: true - # #push: ${{ github.event_name != 'pull_request' }} - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} - # build-args: | - # BUILD_IMAGE=${{ matrix.os-tag }} - # LSB_RELEASE_CODENAME=${{ matrix.codename }} - # DOCKER_CODENAME=${{ matrix.docker-codename }} - # DISTRO=${{ matrix.distro }} - # BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} - # VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} - # REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} - # platforms: linux/amd64 - # cache-from: type=gha - # cache-to: type=gha,mode=max -#EOF +name: "Action Runner Image build" +run-name: "Action Runner Image build «${{ github.ref_name }}» λ${{ github.event_name }}" +on: + workflow_dispatch: + push: + branches: dotnet + paths: + - "build-image.yml" + - "Dockerfile" + - 'Dockerfile.dotnet' + workflow_run: + workflows: [BASE build, RELEASE update] + types: [completed] + +permissions: + contents: read + packages: write + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + pull-build-push: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-jammy-dotnet, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid, debian-bullseye-dotnet, ] + include: + - os: ubuntu-jammy + distro: ubuntu + distro-version: 22.04 + has-latest: true + - os: ubuntu-jammy-dotnet + distro: ubuntu + distro-version: 22.04 + dockerfile: Dockerfile.dotnet + - os: ubuntu-focal + distro: ubuntu + distro-version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + distro-version: 18.04 + - os: debian-bullseye + distro: debian + distro-version: 11 + - os: debian-sid + distro: debian + distro-version: 10 + - os: debian-bullseye-dotnet + dockerfile: Dockerfile.dotnet + distro: debian + distro-version: 11 + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + - name: Set version by default + shell: pwsh + run: | + Write-Output 'PREFIX=${{ matrix.os }}' >> $env:GITHUB_ENV + Write-Output 'REVISION=${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}' >> $env:GITHUB_ENV + Write-Output 'RELEASE_VERSION=${{ vars.GH_RUNNER_VERSION }}' >> $env:GITHUB_ENV + Write-Output 'FULL_TAG=${{ matrix.os }}-${{ vars.GH_RUNNER_VERSION }}-${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}' >> $env:GITHUB_ENV + Write-Output 'BASE_BUILD_IMAGE=${{ vars.RELEASE_IMAGE_NAME }}-base:${{ matrix.os }}' >> $env:GITHUB_ENV + Write-Output 'RELEASE_IMAGE_NAME=${{ vars.RELEASE_IMAGE_NAME }}' >> $env:GITHUB_ENV + $LatestFlag = ([string]::IsNullOrWhitespace('${{ matrix.has-latest }}') ? 'false' : 'true') + Write-Output "LATEST_FLAG=$LatestFlag" >> $env:GITHUB_ENV + if( [string]::IsNullOrWhitespace('${{ matrix.dockerfile }}') ) + { + Write-Output 'DOCKERFILE=Dockerfile' >> $env:GITHUB_ENV + } + else + { + Write-Output 'DOCKERFILE=${{ matrix.dockerfile }}' >> $env:GITHUB_ENV + } + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.ACTOR }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + labels: | + org.opencontainers.image.name=${{ github.ACTOR }}/${{ env.RELEASE_IMAGE_NAME }} + org.opencontainers.image.version=${{ env.FULL_TAG }} + org.opencontainers.image.base.name=${{ github.ACTOR }}/${{ env.BASE_BUILD_IMAGE }} + org.opencontainers.image.revision=${{ env.REVISION }} + org.opencontainers.image.licenses=MIT + images: | + ${{ github.ACTOR }}/${{ env.RELEASE_IMAGE_NAME }} + ghcr.io/${{ github.ACTOR }}/${{ env.RELEASE_IMAGE_NAME }} + flavor: | + latest=false + prefix= + suffix= + tags: | + type=raw,value=${{ env.PREFIX }},enable=true + type=raw,value=${{ env.FULL_TAG }},enable=true + type=raw,value=latest,enable=${{ env.LATEST_FLAG }} + type=raw,value=${{ env.PREFIX }}-latest,enable=${{ env.LATEST_FLAG }} + type=raw,value=${{ env.RELEASE_VERSION }},enable=${{ env.LATEST_FLAG }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ${{ env.DOCKERFILE }} + provenance: true + sbom: true + pull: true + push: true + #push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BASE_IMAGE=${{ github.ACTOR }}/${{ env.BASE_BUILD_IMAGE }} + CHOWN_USER=${{ vars.CHOWN_USER }} + DISTRO=${{ matrix.distro }} + DISTRO_VERSION=${{ matrix.distro-version }} + GH_RUNNER_VERSION=${{ vars.GH_RUNNER_VERSION }} + BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} + VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} + REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + + # build_base_slim: + # runs-on: ubuntu-latest + # #if: ${{ 1 == 2 }} + # #if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event_name == 'workflow_dispatch' }} + # strategy: + # fail-fast: false + # matrix: + # os: [ debian-bullseye, ubuntu-jammy ] + # include: + # - + # os: debian-bullseye + # os-tag: debian:bullseye-slim + # distro: debian + # distro-version: bullseye + # docker-distro-version: bullseye + # - + # os: ubuntu-jammy + # os-tag: ubuntu:jammy + # distro: ubuntu + # distro-version: jammy + # docker-distro-version: jammy + # steps: + # - + # name: Set version prefix + # run: | + # echo "PREFIX_VERSION=${{ matrix.os }}-slim" >> $GITHUB_ENV + # echo "VERSION_NUMBER=${{ github.RUN_NUMBER }}.${{ github.RUN_ATTEMPT }}" >> $GITHUB_ENV + # - + # name: Copy Repo Files + # uses: actions/checkout@v3 + # - + # name: Set up QEMU + # uses: docker/setup-qemu-action@v2 + # - + # name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2 + # - + # name: Login to DockerHub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKER_USER }} + # password: ${{ secrets.DOCKER_TOKEN }} + # - + # name: Login to GitHub Container Registry + # uses: docker/login-action@v2 + # with: + # registry: ghcr.io + # username: ${{ github.ACTOR }} + # password: ${{ secrets.GITHUB_TOKEN }} + # - + # name: Docker meta + # id: meta + # uses: docker/metadata-action@v4 + # with: + # labels: | + # org.opencontainers.image.name=${{ vars.BASE_IMAGE }} + # org.opencontainers.image.version=${{ env.PREFIX_VERSION }}-${{ env.VERSION_NUMBER }} + # org.opencontainers.image.base.name=${{ matrix.os-tag }} + # org.opencontainers.image.revision=${{ env.VERSION_NUMBER }} + # org.opencontainers.image.licenses=MIT + # images: | + # ${{ vars.BASE_IMAGE }} + # ghcr.io/${{ vars.BASE_IMAGE }} + # flavor: | + # latest=false + # prefix= + # suffix= + # tags: | + # type=schedule,enable=true,priority=1000,prefix=,suffix=,pattern=nightly-{{raw}} + # type=raw,value=${{ env.PREFIX_VERSION }}-${{ env.VERSION_NUMBER }},enable=true + # type=raw,value=${{ env.PREFIX_VERSION }},enable=true + # type=raw,value=${{ env.PREFIX_VERSION }}-latest,enable=true + # - + # name: Build and push + # uses: docker/build-push-action@v4 + # with: + # context: . + # file: Dockerfile.base-slim + # provenance: true + # sbom: true + # pull: true + # push: true + # #push: ${{ github.event_name != 'pull_request' }} + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} + # build-args: | + # BUILD_IMAGE=${{ matrix.os-tag }} + # LSB_RELEASE_CODENAME=${{ matrix.codename }} + # DOCKER_CODENAME=${{ matrix.docker-codename }} + # DISTRO=${{ matrix.distro }} + # BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }} + # VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} + # REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} + # platforms: linux/amd64 + # cache-from: type=gha + # cache-to: type=gha,mode=max +#EOF diff --git a/.github/workflows/check-update.yml b/.github/workflows/check-update.yml index d8082c45..893f45b2 100644 --- a/.github/workflows/check-update.yml +++ b/.github/workflows/check-update.yml @@ -1,43 +1,43 @@ -name: "Check for updates" -run-name: "Check for updates ${{ github.ref_name }} by ${{ github.event_name }}" -on: - workflow_dispatch: - push: - paths: - - .github/workflows/check-update.yml - - .github/actions/process-urls/action.yml - - .github/helpers/process-urls.ps1 - schedule: - - cron: "0 * * * *" - -concurrency: - group: check-update - cancel-in-progress: false - -permissions: - contents: write - pull-requests: write - -jobs: - check-for-updates: - runs-on: ubuntu-latest - strategy: - fail-fast: false - env: - GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} - PLATFORMS: 'amd64,arm64' - ENV_PATH: './variables' - CONFIG_FILE: './.github/url-list.json' - steps: - - name: Copy Repo Files - uses: actions/checkout@v3 - - - name: Process URLs - id: process-urls - uses: ./.github/actions/process-urls - with: - config_file: ${{ env.CONFIG_FILE }} - output_prefix: ${{ env.ENV_PATH }} - platforms: ${{ env.PLATFORMS }} - gh_version: ${{ env.GH_RUNNER_VERSION }} - gh_token: ${{ secrets.GITHUB_TOKEN }} +name: "Check for updates" +run-name: "Check for updates «${{ github.ref_name }}» λ${{ github.event_name }}" +on: + workflow_dispatch: + push: + paths: + - .github/workflows/check-update.yml + - .github/actions/process-urls/action.yml + - .github/helpers/process-urls.ps1 + schedule: + - cron: "0 * * * *" + +concurrency: + group: check-update + cancel-in-progress: false + +permissions: + contents: write + pull-requests: write + +jobs: + check-for-updates: + runs-on: ubuntu-latest + strategy: + fail-fast: false + env: + GH_RUNNER_VERSION: ${{ vars.GH_RUNNER_VERSION }} + PLATFORMS: 'amd64,arm64' + ENV_PATH: './variables' + CONFIG_FILE: './.github/url-list.json' + steps: + - name: Copy Repo Files + uses: actions/checkout@v3 + + - name: Process URLs + id: process-urls + uses: ./.github/actions/process-urls + with: + config_file: ${{ env.CONFIG_FILE }} + output_prefix: ${{ env.ENV_PATH }} + platforms: ${{ env.PLATFORMS }} + gh_version: ${{ env.GH_RUNNER_VERSION }} + gh_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/reusable/reusable-docker.yml b/.github/workflows/reusable/reusable-docker.yml new file mode 100644 index 00000000..101e7f28 --- /dev/null +++ b/.github/workflows/reusable/reusable-docker.yml @@ -0,0 +1,173 @@ +name: Reusable Docker build +on: + workflow_call: + inputs: + json_object: + required: true + type: string + secrets: + gh_token: + required: true + docker-user: + required: true + docker-token: + required: true + +env: + GH_REGISTRY: ghcr.io + +jobs: + build-n-push: + runs-on: ubuntu-latest + name: Build and push + strategy: + fail-fast: false + matrix: + os: + [ ubuntu-jammy, ubuntu-focal, ubuntu-bionic, debian-bullseye, debian-sid ] + include: + - os: ubuntu-jammy + distro: ubuntu + codename: jammy + docker_codename: jammy + distro_version: 22.04 + - os: ubuntu-focal + distro: ubuntu + codename: focal + docker_codename: focal + distro_version: 20.04 + - os: ubuntu-bionic + distro: ubuntu + codename: bionic + docker_codename: bionic + distro_version: 18.04 + - os: debian-bullseye + distro: debian + codename: bullseye + docker_codename: bullseye + distro_version: 11 + - os: debian-sid + distro: debian + codename: sid + docker_codename: bullseye + distro_version: 10 + defaults: + run: + shell: pwsh + permissions: + contents: write + packages: write + env: + AGENT_DIR: '' + AGENT_TOOLS_DIRECTORY: '' + CHOWN_USER: '' + BASE_IMAGE_NAME: '' + RELEASE_IMAGE_NAME: '' + BASE_BUILD_IMAGE: '' + TAG_PREFIX: '' + REVISION: '' + FULL_TAG: '' + REPOSITORY_OWNER: ${{ github.repository_owner }} + IMAGE_NAME: '' + BASE_IMAGE_SUFFIX: '' + DOCKER_FILE: '' + RUN_ATTEMPT: 0 + RUN_NUMBER: 1 + PLATFORMS: linux/amd64,linux/arm64 + # Sent: + # agent_dir + # agent_tools_directory + # chown_user + # image_name + # base_image_suffix + # image_tag_prefix + # run_number + # run_attempt + steps: + - + name: Format matrix + env: + JSON_INPUT: ${{ fromJson(inputs.json_object) }} + DISTRO: ${{ matrix.distro }} + CODENAME: ${{ matrix.codename }} + DOCKER_CODENAME: ${{ matrix.docker_codename }} + DISTRO_VERSION: ${{ matrix.distro_version }} + run: | + $Hashmap = $env:JSON_INPUT | Convert-FromJson + $Hashmap.base_image_name = ('{0}:{1}' -f $env:DISTRO, $env:CODENAME) + $Hashmap.release_image_name = ('{0}-{1}' -f $Hashmap.image_name, $env:BASE_IMAGE_SUFFIX) + $Hashmap.base_build_image = ('{0}:{1}' -f $env:DISTRO, $env:CODENAME) + $Hashmap.tag_prefix = ('{0}-{1}-{2}' -f $Hashmap.image_tag_prefix, $env:DISTRO, $env:CODENAME) + $Hashmap.revision = ('{0}-{1}-{2}' -f $Hashmap.run_number, ($Hashmap.run_attempt - 1), $env:DISTRO, $env:CODENAME) + $Hashmap.full_tag = ('{0}-{1}-{2}-{3}.{4}' -f $Hashmap.image_tag_prefix, $env:DISTRO, $env:CODENAME, $Hashmap.run_number, ($Hashmap.run_attempt - 1)) + $Hashmap.docker_file = ('Dockerfile.{0}-{1}' -f $Hashmap.base_image_suffix, $Hashmap.image_tag_prefix) + $Hashmap | %{ Write-Out ('{0}={1}' -f $_.Key.ToUpperInvariant(), $_.Value) >> $env:GITHUB_ENV } + - + name: Error if version not obtained + if: ${{ format('Dockerfile.{0}-{1}', env.base_image_suffix, env.image_tag_prefix) == 'Dockerfile.-' }} + run: | + echo "::error::Release version is empty!" + exit 1 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secret.docker_user }} + password: ${{ secret.docker_token }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.GH_REGISTRY }} + username: ${{ secret.docker_user }} + password: ${{ secret.gh_token }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + labels: | + org.opencontainers.image.name=${{ env.release_image_name }} + org.opencontainers.image.version=${{ env.full_tag }} + org.opencontainers.image.base.name=${{ env.base_build_image }} + org.opencontainers.image.revision=${{ env.revision }} + org.opencontainers.image.licenses=MIT + images: ${{ env.image_list }} + flavor: | + latest=false + prefix= + suffix= + tags: | + type=raw,value=${{ env.full_tag }},enable=true + type=raw,value=${{ env.tag_prefix }},enable=true + + - name: Build and push + if: ${{ success() }} + uses: docker/build-push-action@v4 + with: + context: . + file: ${{ env.docker_file }} + provenance: true + sbom: true + pull: true + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_IMAGE=${{ env.base_build_image }} + CHOWN_USER=${{ env.chown_user }} + LSB_RELEASE_CODENAME=${{ matrix.codename }} + DOCKER_CODENAME=${{ matrix.docker_codename }} + DISTRO=${{ matrix.distro }} + DISTRO_VERSION=${{ matrix.distro_version }} + VERSION=${{ env.DOCKER_METADATA_OUTPUT_VERSION }} + REVISION=${{ env.revision }} + platforms: ${{ env.platforms }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/update-release.yml b/.github/workflows/update-release.yml index 9b283da5..570108a5 100644 --- a/.github/workflows/update-release.yml +++ b/.github/workflows/update-release.yml @@ -1,60 +1,60 @@ -name: "RELEASE update" -run-name: "Update release ${{ github.ref_name }} by ${{ github.event_name }}" -on: - release: - types: [released] - workflow_dispatch: - inputs: - TAG_NAME: - description: 'Tag name that the major tag will point to' - required: true - -permissions: - contents: write - packages: write - -env: - TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} - -jobs: - create-release: - #if: ${{ format('refs/tags/{0}', github.REF) && contains(github.REF, github.REF_NAME) }} - name: Update release - runs-on: ubuntu-latest - defaults: - run: - shell: bash - outputs: - outvar: ${{ steps.last.outputs.RELEASE_VERSION }} - steps: - - - name: Checkout code - uses: actions/checkout@v3 -# - -# name: Set version by default -# run: | -# echo "RELEASE_VERSION=${{ vars.GH_RUNNER_VERSION }}" >> $GITHUB_ENV -# - -# name: Set release version -# run: | -# if [[ ${{ github.REF }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then -# echo "RELEASE_VERSION=${{ github.REF_NAME }}" >> $GITHUB_ENV -# fi -# echo "PUBLISH_RELEASE=1" >> $GITHUB_ENV -# echo "::notice::New RELEASE is publishing!" - - - name: Update release - id: update-release - uses: softprops/action-gh-release@v1 -# if: ${{ env.PUBLISH_RELEASE == 1 }} - with: - tag_name: ${{ env.TAG_NAME }} - name: Release ${{ env.TAG_NAME }} - repository: ${{ github.REPOSITORY }} - token: ${{ secrets.GITHUB_TOKEN }} - generate_release_notes: true - #target_commitish: ${{ github.SHA }} - draft: false - prerelease: false - append_body: true -#EOF +name: "RELEASE update" +run-name: "Update release «${{ github.ref_name }}» λ${{ github.event_name }}" +on: + release: + types: [released] + workflow_dispatch: + inputs: + TAG_NAME: + description: 'Tag name that the major tag will point to' + required: true + +permissions: + contents: write + packages: write + +env: + TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} + +jobs: + create-release: + #if: ${{ format('refs/tags/{0}', github.REF) && contains(github.REF, github.REF_NAME) }} + name: Update release + runs-on: ubuntu-latest + defaults: + run: + shell: bash + outputs: + outvar: ${{ steps.last.outputs.RELEASE_VERSION }} + steps: + - + name: Checkout code + uses: actions/checkout@v3 +# - +# name: Set version by default +# run: | +# echo "RELEASE_VERSION=${{ vars.GH_RUNNER_VERSION }}" >> $GITHUB_ENV +# - +# name: Set release version +# run: | +# if [[ ${{ github.REF }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then +# echo "RELEASE_VERSION=${{ github.REF_NAME }}" >> $GITHUB_ENV +# fi +# echo "PUBLISH_RELEASE=1" >> $GITHUB_ENV +# echo "::notice::New RELEASE is publishing!" + - + name: Update release + id: update-release + uses: softprops/action-gh-release@v1 +# if: ${{ env.PUBLISH_RELEASE == 1 }} + with: + tag_name: ${{ env.TAG_NAME }} + name: Release ${{ env.TAG_NAME }} + repository: ${{ github.REPOSITORY }} + token: ${{ secrets.GITHUB_TOKEN }} + generate_release_notes: true + #target_commitish: ${{ github.SHA }} + draft: false + prerelease: false + append_body: true +#EOF diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..a972362b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "github.vscode-github-actions" + ] +} diff --git a/Dockerfiles/Dockerfile.base-build b/Dockerfiles/Dockerfile.base-build index 3b0c7361..038e3438 100644 --- a/Dockerfiles/Dockerfile.base-build +++ b/Dockerfiles/Dockerfile.base-build @@ -62,17 +62,26 @@ RUN source /tmp/${TARGETARCH}.env \ asciidoc \ autoconf \ docbook2x \ + xmlto \ git \ && apt-get upgrade -yqq \ && wget -qO- "$DOTNET_URL" | bash /dev/stdin --version "$DOTNET_VERSION" --install-dir /usr/share/dotnet \ && (wget -qO- "$PWSH_URL" | tar xz -C /usr/share/pwsh) \ && git clone "$GIT_URL" /tmp/git-src - -RUN export PREFIX=/usr && export BINDIR=/usr/bin && make prefix=/usr all doc info \ +# # export PREFIX=/usr && export BINDIR=/usr/bin && export LIBEXECDIR=/usr/libexec +# TODO: Mkdir in single place! +# TODO: Add to PATH /root/bin +# FIX: && apt-get remove -y git git-man \ +ARG LSB_RELEASE_CODENAME +RUN source /tmp/${TARGETARCH}.env \ && apt-get remove -y git git-man \ - && checkinstall --install=no --fstrans=yes --type=debian --pkgname=git --pkgversion="$GIT_VERSION" --pkgarch="${TARGETARCH}" --pkgrelease="docker" --pkglicense='GPL' --pkgsource=/usr/src --pakdir=/deb --maintainer='derskythe@localhost' --provides='git-completion,git-core' --pkggroup=vcs --gzman --nodoc --strip=1 --backup=0 --showinstall=0 --default --deldoc --dpkgflags --exclude=INSTALL --exclude=COPYING --exclude=README.md --reset-uids \ + && mkdir -p /root/bin /root/libexec /root/share/gitweb/static /root/share/git-core /root/share/gitk/lib /root/share/git-gui \ + && make prefix=/usr all \ + && checkinstall --install=yes --fstrans=yes --type=debian --pkgname=git --pkgversion="$GIT_VERSION" --pkgarch="${TARGETARCH}" --pkgrelease="${LSB_RELEASE_CODENAME}" --pkglicense='GPL' --pkgsource=/usr/src --pakdir=/deb --maintainer='derskythe@localhost' --provides='git-completion,git-core' --pkggroup=vcs --gzman --nodoc --strip=1 --backup=0 --showinstall=0 --default --deldoc --dpkgflags --exclude=INSTALL --exclude=COPYING --exclude=README.md --reset-uids \ + && dpkg -i *.deb \ && ln -s /usr/share/pwsh/pwsh /usr/bin/pwsh \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* +# && rm -rf /var/tmp/* # RUN cat /tmp/${TARGETARCH}.env && source /tmp/${TARGETARCH}.env && echo "$DOTNET_URL" && echo "$DOTNET_VERSION" && wget -qO- "$DOTNET_URL" | bash /dev/stdin --version "$DOTNET_VERSION" --install-dir /usr/share/dotnet # RUN source /tmp/${TARGETARCH}.env && echo "$PWSH_URL" && (wget -qO- "$PWSH_URL" | tar xz -C /usr/share/pwsh) # RUN ln -s /usr/share/pwsh/pwsh /usr/bin/pwsh diff --git a/workflow-templates/starter-build-workflow-properties.json b/workflow-templates/starter-build-workflow-properties.json new file mode 100644 index 00000000..36a39009 --- /dev/null +++ b/workflow-templates/starter-build-workflow-properties.json @@ -0,0 +1,12 @@ +{ + "name": "Builder of Docker containers Workflow", + "description": "Build containers and upload it to Docker/GitHub registry", + "iconName": "layers", + "categories": [ + "Docker" + ], + "filePatterns": [ + "^Dockerfile", + ".*\\.md$" + ] +}