From dc12633f7faaf0f84ef061f727de13c8556d1da8 Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Sat, 16 Sep 2023 00:01:45 +0200 Subject: [PATCH] [no ci] Create copy-full-image.yml --- .github/workflows/copy-full-image.yml | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/copy-full-image.yml diff --git a/.github/workflows/copy-full-image.yml b/.github/workflows/copy-full-image.yml new file mode 100644 index 0000000..239ea29 --- /dev/null +++ b/.github/workflows/copy-full-image.yml @@ -0,0 +1,53 @@ +name: Copy full images + +on: + workflow_dispatch: + inputs: + version: + type: string + default: 20230903.1.0 + +env: + SLUG: ${{ github.repository_owner }}/ubuntu + PUSH_GHCR: ${{ github.repository == (github.event.pull_request.head.repo.full_name || github.repository) && '1' || '' }} + PUSH_QUAY: ${{ secrets.QUAY_USER && secrets.QUAY_TOKEN && '1' || '' }} + PUSH_DOCKER_HUB: ${{ secrets.DOCKER_USER && secrets.DOCKER_TOKEN && '1' || '' }} + +defaults: + run: + shell: sh + +jobs: + copy: + name: copy image ${{ matrix.copy.src }} + runs-on: ubuntu-latest + strategy: + fail-fast: true + max-parallel: 1 + matrix: + copy: + - src: ghcr.io/christopherhx/runner-images:ubuntu22-runner-usr-local-opt-snap-${{ input.version }} + dest: full-latest + - src: ghcr.io/christopherhx/runner-images:ubuntu22-runner-usr-local-opt-snap-${{ input.version }} + dest: full-22.04 + - src: ghcr.io/christopherhx/runner-images:ubuntu20-runner-usr-local-opt-snap-${{ input.version }} + dest: full-20.04 + steps: + - name: Force SLUG to lowercase + uses: actions/github-script@v6 + with: + github-token: n/a + script: | + core.exportVariable('SLUG', process.env.SLUG.toLowerCase()); + + - name: Login to GitHub Container Registry + if: env.PUSH_GHCR + run: skopeo copy -a --src-creds ${{ github.actor }}:${{ github.token }} --dest-creds ${{ github.actor }}:${{ github.token }} docker://${{ matrix.copy.src }} docker://ghcr.io/${{ env.SLUG }}:${{ matrix.copy.dest }} + + - name: Login to Quay + if: env.PUSH_QUAY + run: skopeo copy -a --src-creds ${{ github.actor }}:${{ github.token }} --dest-creds ${{ secrets.QUAY_USER }}:${{ secrets.QUAY_TOKEN }} docker://${{ matrix.copy.src }} docker://quay.io/${{ env.SLUG }}:${{ matrix.copy.dest }} + + - name: Login to Docker Hub + if: env.PUSH_DOCKER_HUB + run: skopeo copy -a --src-creds ${{ github.actor }}:${{ github.token }} --dest-creds ${{ secrets.DOCKER_USER }}:${{ secrets.DOCKER_TOKEN }} docker://${{ matrix.copy.src }} docker://docker.io/${{ env.SLUG }}:${{ matrix.copy.dest }}