ci(docker): upgrade and rework docker ci #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# name: Publish Docker Image | |
# | |
# on: | |
# workflow_dispatch: | |
# push: | |
# branches: | |
# - "main" | |
# # release: | |
# # types: [prereleased,released] | |
# | |
# env: | |
# REGISTRY_IMAGE: daeuniverse/daed | |
# | |
# | |
# jobs: | |
# | |
# build-web: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# # with: | |
# # submodules: 'recursive' | |
# | |
# - uses: pnpm/action-setup@v2 | |
# with: | |
# version: latest | |
# | |
# - uses: actions/setup-node@v3 | |
# with: | |
# cache: pnpm | |
# node-version: latest | |
# | |
# - name: Build | |
# run: | | |
# pnpm install | |
# pnpm build | |
# | |
# - name: Upload artifact - web | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: web | |
# path: dist | |
# | |
# | |
# | |
# build-docker-image: | |
# runs-on: ubuntu-latest | |
# needs: | |
# - build-web | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# platform: | |
# - linux/386 | |
# - linux/amd64 | |
# # - linux/arm/v5 | |
# - linux/arm/v6 | |
# - linux/arm/v7 | |
# - linux/arm64/v8 | |
# - linux/arm64 | |
# # - linux/mips64le | |
# # - linux/ppc64e | |
# # - linux/s390x | |
# steps: | |
# | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# with: | |
# submodules: 'recursive' | |
# | |
# - name: Download artifact - web | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: web | |
# path: dist/ | |
# | |
# - name: Docker meta | |
# id: meta | |
# uses: docker/metadata-action@v5 | |
# with: | |
# images: ${{ env.REGISTRY_IMAGE }} | |
# | |
# - name: Set up QEMU | |
# uses: docker/setup-qemu-action@v3 | |
# | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# | |
# - name: Build and push by digest | |
# id: build | |
# uses: docker/build-push-action@v5 | |
# with: | |
# context: . | |
# platforms: ${{ matrix.platform }} | |
# labels: ${{ steps.meta.outputs.labels }} | |
# outputs: type=image,name=${{ env.REGISTRY_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@v3 | |
# with: | |
# name: digests | |
# path: /tmp/digests/* | |
# if-no-files-found: error | |
# retention-days: 1 | |
# | |
# | |
# | |
# merge: | |
# runs-on: ubuntu-latest | |
# needs: | |
# - build-docker-image | |
# steps: | |
# | |
# - name: Download digests | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: digests | |
# path: /tmp/digests | |
# | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# | |
# - name: Docker meta | |
# id: meta | |
# uses: docker/metadata-action@v5 | |
# with: | |
# images: ${{ env.REGISTRY_IMAGE }} | |
# | |
# - name: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# | |
# - 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.REGISTRY_IMAGE }}@sha256:%s ' *) | |
# | |
# - name: Inspect image | |
# run: | | |
# docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# | |
# # | |
# # | |
# # | |
# # publish-docker-image: | |
# # runs-on: ubuntu-latest | |
# # | |
# # steps: | |
# # - uses: actions/checkout@v4 | |
# # with: | |
# # submodules: 'recursive' | |
# # | |
# # - name: Prepare Tag | |
# # # Borrowed from daeuniverse/dae | |
# # id: prep | |
# # env: | |
# # REF: ${{ github.ref }} | |
# # run: | | |
# # DIR="$(pwd)/dist/" | |
# # if [ -d "$DIR" ]; then | |
# # ### Take action if $DIR exists ### | |
# # echo "Installing config files in ${DIR}..." | |
# # else | |
# # ### Control will jump here if $DIR does NOT exists ### | |
# # echo "Error: ${DIR} not found. Can not continue." | |
# # exit 1 | |
# # fi | |
# # if [[ "$REF" == "refs/tags/v"* ]]; then | |
# # tag=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
# # tag=${tag:1} | |
# # else | |
# # tag=$(git log -1 --format="%cd" --date=short | sed s/-//g) | |
# # fi | |
# # echo "IMAGE=daeuniverse/daed" >> $GITHUB_OUTPUT | |
# # echo "TAG=$tag" >> $GITHUB_OUTPUT | |
# # | |
# # - name: Set up QEMU | |
# # uses: docker/setup-qemu-action@v3 | |
# # | |
# # - name: Set up Docker Buildx | |
# # uses: docker/setup-buildx-action@v3 | |
# # id: buildx | |
# # | |
# # - name: Login to Docker Hub | |
# # uses: docker/login-action@v3 | |
# # with: | |
# # username: ${{ secrets.DOCKERHUB_USERNAME }} | |
# # password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# # | |
# # - name: Login to quay.io | |
# # uses: docker/login-action@v3 | |
# # with: | |
# # registry: quay.io | |
# # username: ${{ github.repository_owner }} | |
# # password: ${{ secrets.QUAY_PASS }} | |
# # | |
# # - name: Login to ghrc.io | |
# # uses: docker/login-action@v3 | |
# # with: | |
# # registry: ghcr.io | |
# # username: ${{ github.actor }} | |
# # password: ${{ secrets.GITHUB_TOKEN }} | |
# # | |
# # - name: Build image | |
# # uses: docker/build-push-action@v5 | |
# # with: | |
# # context: . | |
# # build-args: DAED_VERSION=${{ steps.prep.outputs.TAG }} | |
# # builder: ${{ steps.buildx.outputs.name }} | |
# # file: publish.Dockerfile | |
# # target: this-image-is-built-for-final-publish-with-support-of-multiple-platforms | |
# # platforms: linux/386,linux/amd64,linux/arm64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64e,linux/s390x | |
# # push: true | |
# # tags: | | |
# # ${{ github.repository }}:latest | |
# # quay.io/${{ github.repository }}:latest | |
# # ghcr.io/${{ github.repository }}:latest | |
# # ${{ github.repository }}:${{ steps.prep.outputs.TAG }} | |
# # quay.io/${{ github.repository }}:${{ steps.prep.outputs.TAG }} | |
# # ghcr.io/${{ github.repository }}:${{ steps.prep.outputs.TAG }} | |
# # cache-from: type=gha | |
# # cache-to: type=gha,mode=max |