-
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.62 KB
/
sync.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
name: hub.docker.com -> us-docker.pkg.dev
on:
schedule:
- cron: "0 7 * * *"
workflow_dispatch:
jobs:
sync-images:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: checkout
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
id: 'auth'
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.GCLOUD_OIDC_POOL }}
service_account: ${{ secrets.GSA }}
token_format: 'access_token'
- uses: docker/login-action@v3
name: 'Docker login'
with:
registry: 'us-docker.pkg.dev'
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- name: pull+push
run: |
REPOS=$(curl -s "https://hub.docker.com/v2/repositories/lehighlts/?page_size=100" | \
jq -r '.results[] | select(.name | startswith("scyllaridae-")) | .name')
for REPO in $REPOS; do
SOURCE="lehighlts/$REPO:main"
TARGET="us-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/shared/$REPO:main"
docker pull "$SOURCE"
docker tag "$SOURCE" "$TARGET"
docker push "$TARGET"
done
docker pull islandora/fits:main
docker tag islandora/fits:main us-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/shared/harvard-fits:main
docker push us-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/shared/harvard-fits:main
- name: ⛴️
run: gh workflow run apply.yml
env:
GH_TOKEN: ${{ github.token }}