diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index b4b726e35..d3c2a3f44 100644 --- a/.github/workflows/build-api.yml +++ b/.github/workflows/build-api.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/api on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,24 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/api + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +48,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./api + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/api" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/api:$(git rev-parse --short HEAD),voltaserve/api:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./api - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/build-console.yml b/.github/workflows/build-console.yml index 2cf8f7b1c..8b8f22834 100644 --- a/.github/workflows/build-console.yml +++ b/.github/workflows/build-console.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/console on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,24 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/console + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +48,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./console + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/console" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the tag on workflow dispatch - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/console:$(git rev-parse --short HEAD)" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./console - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/build-conversion.yml b/.github/workflows/build-conversion.yml index cf00dd40e..0f4c3223d 100644 --- a/.github/workflows/build-conversion.yml +++ b/.github/workflows/build-conversion.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/conversion on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,24 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/conversion + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +48,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./conversion + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/conversion" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/conversion:$(git rev-parse --short HEAD),voltaserve/conversion:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./conversion - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/build-idp.yml b/.github/workflows/build-idp.yml index 255d6f86c..c5163507f 100644 --- a/.github/workflows/build-idp.yml +++ b/.github/workflows/build-idp.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/idp on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,23 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/idp + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +47,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./idp + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/idp" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/idp:$(git rev-parse --short HEAD),voltaserve/idp:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./idp - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/build-language.yml b/.github/workflows/build-language.yml index 6ae505e6f..ae0293243 100644 --- a/.github/workflows/build-language.yml +++ b/.github/workflows/build-language.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/language on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,24 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/language + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +48,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./language + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/language" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/language:$(git rev-parse --short HEAD),voltaserve/language:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./language - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/build-migrations.yml b/.github/workflows/build-migrations.yml index 25046b5f5..12f5f1da8 100644 --- a/.github/workflows/build-migrations.yml +++ b/.github/workflows/build-migrations.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/migrations on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,23 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/migrations + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,33 +47,73 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./migrations + cache-from: type=gha + cache-to: type=gha,mode=max + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/migrations" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/migrations:$(git rev-parse --short HEAD),voltaserve/migrations:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./migrations - cache-from: type=gha - cache-to: type=gha,mode=max - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) diff --git a/.github/workflows/build-mosaic.yml b/.github/workflows/build-mosaic.yml index 29e95a25d..529ec6c38 100644 --- a/.github/workflows/build-mosaic.yml +++ b/.github/workflows/build-mosaic.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/mosaic on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,23 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/mosaic + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +47,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./mosaic + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/mosaic" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/mosaic:$(git rev-parse --short HEAD),voltaserve/mosaic:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./mosaic - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/build-ui.yml b/.github/workflows/build-ui.yml index 086839583..388977376 100644 --- a/.github/workflows/build-ui.yml +++ b/.github/workflows/build-ui.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/ui on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,23 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/ui + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +47,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./ui + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/ui" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/ui:$(git rev-parse --short HEAD),voltaserve/ui:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./ui - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/build-webdav.yml b/.github/workflows/build-webdav.yml index 839990842..66d78acb5 100644 --- a/.github/workflows/build-webdav.yml +++ b/.github/workflows/build-webdav.yml @@ -12,12 +12,6 @@ name: Build and Push voltaserve/webdav on: workflow_dispatch: - inputs: - branch: - required: false - default: "" - type: string - description: Override code checkout branch (e.g. "feature/branch") push: branches: - main @@ -26,23 +20,23 @@ on: tags: - 'v*' +env: + IMAGE: voltaserve/webdav + jobs: - build_and_push: + build: runs-on: ubuntu-latest + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - - name: Prepare input branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_ENV - - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ env.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,31 +47,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Create tag list matching semver from executing tag - if: ${{ github.ref_type == 'tag' }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + tags: | + type=ref,event=branch,enable=${{ github.ref_type != 'tag' }} + type=ref,event=tag + type=sha,enable=${{ github.ref_type != 'tag' }} + type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }} + type=semver,pattern={{major}},enable=${{ github.ref_type == 'tag' }} + + - name: Build and Push Docker Image + id: build + uses: docker/build-push-action@v6 + with: + context: ./webdav + platforms: ${{ matrix.platform }} + labels: ${{ steps.meta.outputs.labels }} + outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest run: | - name="voltaserve/webdav" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ matrix.platform }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: /tmp/digests + pattern: digests-* + merge-multiple: true - TAGS+=",$name:latest" - echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Set the docker tag on runs other than tag push - if: ${{ github.ref_type != 'tag' }} - run: echo "TAGS=voltaserve/webdav:$(git rev-parse --short HEAD),voltaserve/webdav:main" >> $GITHUB_ENV + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - context: ./webdav - push: true - tags: ${{ env.TAGS }} - platforms: linux/amd64,linux/arm64 + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.IMAGE }}@sha256:%s ' *) \ No newline at end of file diff --git a/.github/workflows/check-on-pr-api.yml b/.github/workflows/check-on-pr-api.yml index 6958acad2..48c7ee706 100644 --- a/.github/workflows/check-on-pr-api.yml +++ b/.github/workflows/check-on-pr-api.yml @@ -36,6 +36,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -43,7 +46,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,4 +56,4 @@ jobs: with: context: ./api push: false - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/${{ matrix.platform }} \ No newline at end of file diff --git a/.github/workflows/check-on-pr-console.yml b/.github/workflows/check-on-pr-console.yml index 9ceefb20d..4f899812e 100644 --- a/.github/workflows/check-on-pr-console.yml +++ b/.github/workflows/check-on-pr-console.yml @@ -36,7 +36,6 @@ jobs: ignore: "F401,W291" max-line-length: "120" exclude: ".git,Dockerfile" -# plugins: "flake8-black" permissions: contents: read diff --git a/.github/workflows/check-on-pr-conversion.yml b/.github/workflows/check-on-pr-conversion.yml index 2b72d34f6..42e862a1b 100644 --- a/.github/workflows/check-on-pr-conversion.yml +++ b/.github/workflows/check-on-pr-conversion.yml @@ -36,6 +36,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -43,7 +46,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,4 +56,4 @@ jobs: with: context: ./conversion push: false - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/${{ matrix.platform }} \ No newline at end of file diff --git a/.github/workflows/check-on-pr-idp.yml b/.github/workflows/check-on-pr-idp.yml index 24269a540..2a61efdea 100644 --- a/.github/workflows/check-on-pr-idp.yml +++ b/.github/workflows/check-on-pr-idp.yml @@ -48,6 +48,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -55,7 +58,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -65,4 +68,4 @@ jobs: with: context: ./idp push: false - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/${{ matrix.platform }} \ No newline at end of file diff --git a/.github/workflows/check-on-pr-language.yml b/.github/workflows/check-on-pr-language.yml index 65fd809cf..bbce45cbd 100644 --- a/.github/workflows/check-on-pr-language.yml +++ b/.github/workflows/check-on-pr-language.yml @@ -34,9 +34,8 @@ jobs: with: path: language ignore: "E203" - max-line-length: "88" + max-line-length: "120" exclude: ".git,.venv,.dockerignore,.pdm-python,Dockerfile" - plugins: "flake8-black" permissions: contents: read @@ -46,6 +45,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -53,7 +55,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -63,4 +65,4 @@ jobs: with: context: ./language push: false - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/${{ matrix.platform }} \ No newline at end of file diff --git a/.github/workflows/check-on-pr-migrations.yml b/.github/workflows/check-on-pr-migrations.yml index 80307add9..30d1c9536 100644 --- a/.github/workflows/check-on-pr-migrations.yml +++ b/.github/workflows/check-on-pr-migrations.yml @@ -34,6 +34,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -41,7 +44,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,4 +56,4 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max push: false - platforms: linux/amd64,linux/arm64 + platforms: linux/${{ matrix.platform }} diff --git a/.github/workflows/check-on-pr-mosaic.yml b/.github/workflows/check-on-pr-mosaic.yml index d10dadb48..912512edb 100644 --- a/.github/workflows/check-on-pr-mosaic.yml +++ b/.github/workflows/check-on-pr-mosaic.yml @@ -36,6 +36,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -43,7 +46,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,4 +56,4 @@ jobs: with: context: ./mosaic push: false - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/${{ matrix.platform }} \ No newline at end of file diff --git a/.github/workflows/check-on-pr-ui.yml b/.github/workflows/check-on-pr-ui.yml index fb8d2c3e3..e8444b4f9 100644 --- a/.github/workflows/check-on-pr-ui.yml +++ b/.github/workflows/check-on-pr-ui.yml @@ -53,6 +53,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -60,7 +63,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -70,4 +73,4 @@ jobs: with: context: ./ui push: false - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/${{ matrix.platform }} \ No newline at end of file diff --git a/.github/workflows/check-on-pr-webdav.yml b/.github/workflows/check-on-pr-webdav.yml index 361b1068b..604a5ba65 100644 --- a/.github/workflows/check-on-pr-webdav.yml +++ b/.github/workflows/check-on-pr-webdav.yml @@ -36,6 +36,9 @@ jobs: build: runs-on: ubuntu-latest needs: lint + strategy: + matrix: + platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -43,7 +46,7 @@ jobs: - name: Set Up QEMU uses: docker/setup-qemu-action@v3 with: - platforms: arm64, amd64 + platforms: ${{ matrix.platform }} - name: Set Up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -53,4 +56,4 @@ jobs: with: context: ./webdav push: false - platforms: linux/amd64,linux/arm64 \ No newline at end of file + platforms: linux/${{ matrix.platform }} \ No newline at end of file