|
10 | 10 | push:
|
11 | 11 | tags:
|
12 | 12 | - "*"
|
| 13 | + branches: |
| 14 | + - "*" |
13 | 15 |
|
14 | 16 | jobs:
|
15 | 17 | build-image:
|
16 | 18 | runs-on: ubuntu-latest
|
| 19 | + needs: create-final-image |
17 | 20 | strategy:
|
18 | 21 | fail-fast: false
|
19 | 22 | max-parallel: 4
|
|
57 | 60 | create-final-image:
|
58 | 61 | runs-on: ubuntu-latest
|
59 | 62 | needs: build-image
|
| 63 | + name: Create the image manifest |
60 | 64 | steps:
|
61 | 65 | - name: Login to DockerHub
|
62 | 66 | uses: docker/login-action@v2
|
|
77 | 81 | run: docker manifest push docker.io/botsudo/docker-rustpython:latest
|
78 | 82 | - name: Inspect the manifest
|
79 | 83 | run: docker manifest inspect docker.io/botsudo/docker-rustpython:latest
|
| 84 | + tags-cleanup: |
| 85 | + runs-on: ubuntu-latest |
| 86 | + name: Cleanup build tags |
| 87 | + steps: |
| 88 | + - name: Install Docker hub-tool |
| 89 | + run: | |
| 90 | + curl -sL https://github.com/docker/hub-tool/releases/download/v0.4.5/hub-tool-linux-amd64.tar.gz -o hub-tool-linux.tar.gz |
| 91 | + tar --strip-components=1 -xzf ./hub-tool-linux.tar.gz |
| 92 | + ./hub-tool --version |
| 93 | + - name: Login hub-tool |
| 94 | + run: | |
| 95 | + # Fool the login command (https://github.com/docker/hub-tool/pull/198) |
| 96 | + # ./hub-tool login |
| 97 | + # Token commands thank to https://stackoverflow.com/a/59334315/5155484 |
| 98 | + HUB_TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d "{\"username\": \"$DOCKER_USERNAME\", \"password\": \"$DOCKER_PASSWORD\"}" https://hub.docker.com/v2/users/login/ | jq -r .token) |
| 99 | + USERNAME="$(printf '%s:' "$DOCKER_USERNAME" | base64 -w0)" |
| 100 | + USER_PASS="$(printf '%s:%s' "$DOCKER_USERNAME" "$DOCKER_PASSWORD" | base64 -w0)" |
| 101 | + mkdir -p ~/.docker/ |
| 102 | + printf '{"auths": {"hub-tool": {"auth": "%s"}, "hub-tool-refresh-token": {"auth": "%s"}, "hub-tool-token": { "auth": "%s", "identitytoken": "%s"}}}' \ |
| 103 | + "$USER_PASS" "$USERNAME" \ |
| 104 | + "$USERNAME" "$HUB_TOKEN" \ |
| 105 | + > ~/.docker/config.json |
| 106 | + env: |
| 107 | + DOCKER_USERNAME: ${{ secrets.DOCKER_REPOSITORY_LOGIN }} |
| 108 | + DOCKER_PASSWORD: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }} |
| 109 | + - name: Remove PR container image via hub-tool |
| 110 | + run: | |
| 111 | + ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:armv6-latest || true |
| 112 | + ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:armv7-latest || true |
| 113 | + ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:arm64v8-latest || true |
| 114 | + ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:386-latest || true |
| 115 | + ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:ppc64le-latest || true |
| 116 | + ./hub-tool tag rm --verbose --force docker.io/botsudo/docker-rustpython:amd64-latest || true |
| 117 | + - name: Logout hub-tool |
| 118 | + run: rm ~/.docker/config.json |
0 commit comments