diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml index 555e5a8a1..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,57 +20,19 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT +env: + IMAGE: voltaserve/api - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} - - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/api" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/api:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - build_and_push: +jobs: + build: runs-on: ubuntu-latest - needs: prepare_env strategy: + fail-fast: false matrix: platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare_env.outputs.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 @@ -92,10 +48,71 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 - uses: docker/build-push-action@v5 + id: build + uses: docker/build-push-action@v6 with: context: ./api - push: true - tags: ${{ needs.prepare_env.outputs.tags }} - platforms: ${{ matrix.platform }} \ No newline at end of file + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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 96d14c49d..8b8f22834 100644 --- a/.github/workflows/build-console.yml +++ b/.github/workflows/build-console.yml @@ -34,19 +34,6 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - 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: Set Up QEMU uses: docker/setup-qemu-action@v3 with: @@ -61,6 +48,19 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 diff --git a/.github/workflows/build-conversion.yml b/.github/workflows/build-conversion.yml index 247e59dcc..0bb8dcb72 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,57 +20,19 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT +env: + IMAGE: voltaserve/conversion - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} - - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/conversion" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/conversion:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - build_and_push: +jobs: + build: runs-on: ubuntu-latest - needs: prepare_env strategy: + fail-fast: false matrix: platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare_env.outputs.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 @@ -92,10 +48,70 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 uses: docker/build-push-action@v5 with: context: ./conversion - push: true - tags: ${{ needs.prepare_env.outputs.tags }} - platforms: ${{ matrix.platform }} \ No newline at end of file + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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 34e023746..f21f54708 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,57 +20,18 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT +env: + IMAGE: voltaserve/idp - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} - - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/idp" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/idp:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - build_and_push: +jobs: + build: runs-on: ubuntu-latest - needs: prepare_env strategy: matrix: platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare_env.outputs.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 @@ -92,10 +47,70 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 uses: docker/build-push-action@v5 with: context: ./idp - push: true - tags: ${{ needs.prepare_env.outputs.tags }} - platforms: ${{ matrix.platform }} \ No newline at end of file + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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 2e73f938c..9e3ca79e4 100644 --- a/.github/workflows/build-language.yml +++ b/.github/workflows/build-language.yml @@ -26,49 +26,12 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT - - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} - - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/language" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/language:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT +env: + IMAGE: voltaserve/language +jobs: build_and_push: runs-on: ubuntu-latest - needs: prepare_env strategy: matrix: platform: [ "arm64", "amd64" ] @@ -92,10 +55,70 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 uses: docker/build-push-action@v5 with: context: ./language - push: true - tags: ${{ needs.prepare_env.outputs.tags }} - platforms: ${{ matrix.platform }} \ No newline at end of file + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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 192425c20..7e2abc34e 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,57 +20,18 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT - - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} +env: + IMAGE: voltaserve/migrations - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/migrations" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/migrations:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - build_and_push: +jobs: + build: runs-on: ubuntu-latest - needs: prepare_env strategy: matrix: platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare_env.outputs.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 @@ -92,12 +47,72 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 uses: docker/build-push-action@v5 with: context: ./migrations cache-from: type=gha - cache-to: type=gha,mode=max - push: true - tags: ${{ needs.prepare_env.outputs.tags }} + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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 6d559ee3a..a8b131ad5 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,57 +20,18 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT +env: + IMAGE: voltaserve/mosaic - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} - - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/mosaic" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/mosaic:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - build_and_push: +jobs: + build: runs-on: ubuntu-latest - needs: prepare_env strategy: matrix: platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare_env.outputs.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 @@ -92,10 +47,70 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 uses: docker/build-push-action@v5 with: context: ./mosaic - push: true - tags: ${{ needs.prepare_env.outputs.tags }} - platforms: ${{ matrix.platform }} \ No newline at end of file + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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 1f0b4d5a2..a8a8aa5ae 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,57 +20,18 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT +env: + IMAGE: voltaserve/ui - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} - - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/ui" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/ui:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - build_and_push: +jobs: + build: runs-on: ubuntu-latest - needs: prepare_env strategy: matrix: platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare_env.outputs.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 @@ -92,10 +47,70 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 uses: docker/build-push-action@v5 with: context: ./ui - push: true - tags: ${{ needs.prepare_env.outputs.tags }} - platforms: ${{ matrix.platform }} \ No newline at end of file + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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 d3cfc2229..7b8975f9d 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,57 +20,18 @@ on: tags: - 'v*' -jobs: - prepare_env: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.input_branch.outputs.branch }} - tags: ${{ steps.tag.outputs.tags || steps.tags.outputs.tags }} - steps: - - name: Prepare input branch - id: input_branch - if: ${{ github.event.inputs.branch != '' }} - run: echo "branch=refs/heads/${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT - - - name: Checkout Repository - uses: actions/checkout@v4 - with: - ref: ${{ steps.input_branch.outputs.branch || github.ref }} - - - name: Create tag list matching semver from executing tag - id: tag - if: ${{ github.ref_type == 'tag' }} - run: | - name="voltaserve/webdav" - version="${{ github.ref_name }}" - version="${version#v}" - IFS='.' read -r -a parts <<< "$version" - TAGS="$name:$version" - - for ((i=${#parts[@]}-1; i>0; i--)); do - tag=$(IFS='.'; echo "${parts[*]:0:$i}") - TAGS+=",$name:$tag" - done - - TAGS+=",$name:latest" - echo "tags=$TAGS" >> $GITHUB_OUTPUT - - - name: Set the tag on workflow dispatch - id: tags - if: ${{ github.ref_type != 'tag' }} - run: echo "tags=voltaserve/webdav:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT +env: + IMAGE: voltaserve/webdav +jobs: build_and_push: runs-on: ubuntu-latest - needs: prepare_env strategy: matrix: platform: [ "arm64", "amd64" ] steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - ref: ${{ needs.prepare_env.outputs.branch || github.ref }} - name: Set Up QEMU uses: docker/setup-qemu-action@v3 @@ -92,10 +47,70 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - 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 uses: docker/build-push-action@v5 with: context: ./webdav - push: true - tags: ${{ needs.prepare_env.outputs.tags }} - platforms: ${{ matrix.platform }} \ No newline at end of file + 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: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - 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 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + 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