|
15 | 15 | - cron: '30 11 20 * *' |
16 | 16 |
|
17 | 17 | env: |
18 | | - REGISTRY_IMAGE: andy5995/linuxdeploy |
| 18 | + DH_REGISTRY_IMAGE: andy5995/linuxdeploy |
| 19 | + GHCR_REGISTRY_IMAGE: ghcr.io/andy5995/linuxdeploy-build-helper-container |
19 | 20 | VERSION: v3 |
20 | 21 |
|
21 | 22 | jobs: |
@@ -43,15 +44,26 @@ jobs: |
43 | 44 | id: meta |
44 | 45 | uses: docker/metadata-action@v5 |
45 | 46 | with: |
46 | | - images: ${{ env.REGISTRY_IMAGE }} |
| 47 | + images: | |
| 48 | + ${{ env.DH_REGISTRY_IMAGE }} |
| 49 | + ${{ env.GHCR_REGISTRY_IMAGE }} |
47 | 50 |
|
48 | 51 | - name: Set up Docker Buildx |
49 | 52 | uses: docker/setup-buildx-action@v3 |
| 53 | + |
50 | 54 | - name: Login to Docker Hub |
51 | 55 | uses: docker/login-action@v3 |
52 | 56 | with: |
53 | 57 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
54 | 58 | password: ${{ secrets.UNCLE_ANDY_DOCKERHUB_ACCESS_TOKEN }} |
| 59 | + |
| 60 | + - name: Login to GitHub Container Registry |
| 61 | + uses: docker/login-action@v3 |
| 62 | + with: |
| 63 | + registry: ghcr.io |
| 64 | + username: ${{ github.repository_owner }} |
| 65 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
55 | 67 | - name: Build and push by digest |
56 | 68 | id: build |
57 | 69 | uses: docker/build-push-action@v6 |
|
60 | 72 | build-args: CODENAME=${{ matrix.codename }} |
61 | 73 | file: ./Dockerfile |
62 | 74 | labels: ${{ steps.meta.outputs.labels }} |
63 | | - outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true |
64 | | - cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:${{ matrix.codename }}-${{ env.PLATFORM_PAIR }}-${{ env.VERSION }}-buildcache |
65 | | - cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:${{ matrix.codename }}-${{ env.PLATFORM_PAIR }}-${{ env.VERSION }}-buildcache,mode=max |
| 75 | + outputs: | |
| 76 | + type=image,name=${{ env.DH_REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true |
| 77 | + type=image,name=${{ env.GHCR_REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true |
| 78 | + cache-from: type=registry,ref=${{ env.DH_REGISTRY_IMAGE }}:${{ matrix.codename }}-${{ env.PLATFORM_PAIR }}-${{ env.VERSION }}-buildcache |
| 79 | + cache-to: type=registry,ref=${{ env.DH_REGISTRY_IMAGE }}:${{ matrix.codename }}-${{ env.PLATFORM_PAIR }}-${{ env.VERSION }}-buildcache,mode=max |
| 80 | + |
| 81 | + |
66 | 82 | - name: Export digest |
67 | 83 | run: | |
68 | 84 | mkdir -p /tmp/digests |
@@ -94,25 +110,43 @@ jobs: |
94 | 110 | path: /tmp/digests |
95 | 111 | pattern: digests-${{ matrix.codename }}-* |
96 | 112 | merge-multiple: true |
| 113 | + |
97 | 114 | - name: Set up Docker Buildx |
98 | 115 | uses: docker/setup-buildx-action@v3 |
| 116 | + |
99 | 117 | - name: Docker meta |
100 | 118 | id: meta |
101 | 119 | uses: docker/metadata-action@v5 |
102 | 120 | with: |
103 | | - images: ${{ env.REGISTRY_IMAGE }} |
| 121 | + images: | |
| 122 | + ${{ env.DH_REGISTRY_IMAGE }} |
| 123 | + ${{ env.GHCR_REGISTRY_IMAGE }} |
104 | 124 | tags: | |
105 | 125 | type=raw,value=${{ env.VERSION }}-${{ matrix.codename }} |
| 126 | +
|
106 | 127 | - name: Login to Docker Hub |
107 | 128 | uses: docker/login-action@v3 |
108 | 129 | with: |
109 | 130 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
110 | 131 | password: ${{ secrets.UNCLE_ANDY_DOCKERHUB_ACCESS_TOKEN }} |
| 132 | + |
| 133 | + - name: Login to GitHub Container Registry |
| 134 | + uses: docker/login-action@v3 |
| 135 | + with: |
| 136 | + registry: ghcr.io |
| 137 | + username: ${{ github.repository_owner }} |
| 138 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + |
111 | 140 | - name: Create manifest list and push |
112 | 141 | working-directory: /tmp/digests |
113 | 142 | run: | |
114 | | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
115 | | - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) |
| 143 | + for build in ${DH_REGISTRY_IMAGE} ${GHCR_REGISTRY_IMAGE}; do |
| 144 | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
| 145 | + $(printf "${build}@sha256:%s " *) |
| 146 | + done |
| 147 | +
|
116 | 148 | - name: Inspect image |
117 | 149 | run: | |
118 | | - docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} |
| 150 | + for build in ${DH_REGISTRY_IMAGE} ${GHCR_REGISTRY_IMAGE}; do |
| 151 | + docker buildx imagetools inspect ${build}:${{ steps.meta.outputs.version }} |
| 152 | + done |
0 commit comments