name: Build docker image and package for linux inputs: release-build: required: false type: string build-unix-time: required: false type: string build-date: required: false type: string check-3rd-api: required: false type: string skip-tests: required: false type: string platform: required: true type: string platform-name: required: true type: string docker-push: required: true type: boolean docker-image-name: required: true type: string docker-username: required: false type: string docker-password: required: false type: string docker-bake-meta-file-path: required: true type: string docker-bake-meta-artifact-name: required: true type: string docker-bake-digests-file-path: required: true type: string docker-bake-digests-artifact-name-prefix: required: true type: string package-file-name-prefix: required: true type: string package-artifact-name-prefix: required: true type: string runs: using: "composite" steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Download docker bake meta artifact uses: actions/download-artifact@v4 with: name: ${{ inputs.docker-bake-meta-artifact-name }} path: ${{ runner.temp }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to DockerHub if: ${{ inputs.docker-username != '' && inputs.docker-password != '' }} uses: docker/login-action@v3 with: username: ${{ inputs.docker-username }} password: ${{ inputs.docker-password }} - name: Build docker for ${{ inputs.platform-name }} id: bake uses: docker/bake-action@v6 with: files: | ./docker-bake.hcl cwd://${{ inputs.docker-bake-meta-file-path }} source: . targets: image set: | *.tags=${{ inputs.docker-image-name }} *.platform=${{ inputs.platform }} *.args.RELEASE_BUILD=${{ inputs.release-build }} *.args.BUILD_PIPELINE=1 *.args.BUILD_UNIXTIME=${{ inputs.build-unix-time }} *.args.BUILD_DATE=${{ inputs.build-date }} *.args.CHECK_3RD_API=${{ inputs.check-3rd-api }} *.args.SKIP_TESTS=${{ inputs.skip-tests }} *.output=type=image,push-by-digest=true,name-canonical=true,push=${{ inputs.docker-push }} *.output+=type=local,dest=${{ runner.temp }}/package - name: Export digests file for ${{ inputs.platform-name }} shell: bash run: | digest="${{ fromJSON(steps.bake.outputs.metadata).image['containerimage.digest'] }}" mkdir -p ${{ inputs.docker-bake-digests-file-path }} touch "${{ inputs.docker-bake-digests-file-path }}/${digest#sha256:}" - name: Build package file for ${{ inputs.platform-name }} shell: bash run: | cd ${{ runner.temp }}/package/ezbookkeeping tar -czf ${{ runner.temp }}/${{ inputs.package-file-name-prefix }}-${{ inputs.platform-name }}.tar.gz * - name: Upload ${{ inputs.platform-name }} digests artifact uses: actions/upload-artifact@v4 with: name: ${{ inputs.docker-bake-digests-artifact-name-prefix }}-${{ inputs.platform-name }} path: ${{ inputs.docker-bake-digests-file-path }}/* if-no-files-found: error - name: Upload artifact for ${{ inputs.platform-name }} uses: actions/upload-artifact@v4 with: name: ${{ inputs.package-artifact-name-prefix }}-${{ inputs.platform-name }} path: ${{ runner.temp }}/${{ inputs.package-file-name-prefix }}-${{ inputs.platform-name }}.tar.gz if-no-files-found: error