-
Notifications
You must be signed in to change notification settings - Fork 83
55 lines (48 loc) · 2.16 KB
/
copy-full-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Copy full images
on:
workflow_dispatch:
inputs:
version:
type: string
default: latest
schedule:
- cron: 0 12 */7 * *
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-large-${{ inputs.version || 'latest' }}
dest: full-latest
- src: ghcr.io/christopherhx/runner-images:ubuntu22-runner-large-${{ inputs.version || 'latest' }}
dest: full-22.04
- src: ghcr.io/christopherhx/runner-images:ubuntu20-runner-large-${{ inputs.version || 'latest' }}
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 }}