Showing the changes to .github (1 of 1 file). Show all
Unified · Split
| @@ -22,6 +22,8 @@ jobs: · 21 unmodified lines | |||
| 22 | permissions: | 22 | permissions: |
| 23 | contents: read | 23 | contents: read |
| 24 | packages: write | 24 | packages: write |
| 25 | env: | ||
| 26 | HAS_LEGACY_TOKEN: ${{ secrets.GHCR_LEGACY_TOKEN != '' }} | ||
| 25 | 27 | ||
| 26 | steps: | 28 | steps: |
| 27 | - name: Checkout | 29 | - name: Checkout |
| @@ -57,6 +59,7 @@ jobs: · 29 unmodified lines | |||
| 57 | version="${RELEASE_TAG#v}" | 59 | version="${RELEASE_TAG#v}" |
| 58 | owner="$(printf '%s' "$GITHUB_REPOSITORY_OWNER" | tr '[:upper:]' '[:lower:]')" | 60 | owner="$(printf '%s' "$GITHUB_REPOSITORY_OWNER" | tr '[:upper:]' '[:lower:]')" |
| 59 | image="ghcr.io/${owner}/executor-selfhost" | 61 | image="ghcr.io/${owner}/executor-selfhost" |
| 62 | legacy_image="ghcr.io/rhyssullivan/executor-selfhost" | ||
| 60 | revision="$(git rev-parse HEAD)" | 63 | revision="$(git rev-parse HEAD)" |
| 61 | 64 | ||
| 62 | if [[ "$version" == *-* ]]; then | 65 | if [[ "$version" == *-* ]]; then |
| @@ -74,6 +77,11 @@ jobs: · 11 unmodified lines | |||
| 74 | echo "${image}:${version}" | 77 | echo "${image}:${version}" |
| 75 | echo "${image}:${channel}" | 78 | echo "${image}:${channel}" |
| 76 | echo "TAGS" | 79 | echo "TAGS" |
| 80 | echo "legacy_tags<<TAGS" | ||
| 81 | echo "${legacy_image}:${RELEASE_TAG}" | ||
| 82 | echo "${legacy_image}:${version}" | ||
| 83 | echo "${legacy_image}:${channel}" | ||
| 84 | echo "TAGS" | ||
| 77 | echo "labels<<LABELS" | 85 | echo "labels<<LABELS" |
| 78 | echo "org.opencontainers.image.title=Executor self-host" | 86 | echo "org.opencontainers.image.title=Executor self-host" |
| 79 | echo "org.opencontainers.image.description=Single-container self-hosted Executor" | 87 | echo "org.opencontainers.image.description=Single-container self-hosted Executor" |
| @@ -97,6 +105,7 @@ jobs: · 17 unmodified lines | |||
| 97 | password: ${{ secrets.GITHUB_TOKEN }} | 105 | password: ${{ secrets.GITHUB_TOKEN }} |
| 98 | 106 | ||
| 99 | - name: Build and push self-host image | 107 | - name: Build and push self-host image |
| 108 | id: build | ||
| 100 | uses: useblacksmith/build-push-action@v2 | 109 | uses: useblacksmith/build-push-action@v2 |
| 101 | with: | 110 | with: |
| 102 | context: . | 111 | context: . |
| @@ -105,3 +114,32 @@ jobs: · 2 unmodified lines | |||
| 105 | push: true | 114 | push: true |
| 106 | tags: ${{ steps.image.outputs.tags }} | 115 | tags: ${{ steps.image.outputs.tags }} |
| 107 | labels: ${{ steps.image.outputs.labels }} | 116 | labels: ${{ steps.image.outputs.labels }} |
| 117 | |||
| 118 | - name: Skip legacy GHCR mirror (GHCR_LEGACY_TOKEN not configured) | ||
| 119 | if: env.HAS_LEGACY_TOKEN != 'true' | ||
| 120 | run: echo "GHCR_LEGACY_TOKEN is not configured; skipping legacy GHCR mirror." | ||
| 121 | |||
| 122 | - name: Log in to legacy GHCR namespace | ||
| 123 | if: env.HAS_LEGACY_TOKEN == 'true' | ||
| 124 | uses: docker/login-action@v3 | ||
| 125 | with: | ||
| 126 | registry: ghcr.io | ||
| 127 | username: rhyssullivan | ||
| 128 | password: ${{ secrets.GHCR_LEGACY_TOKEN }} | ||
| 129 | |||
| 130 | - name: Mirror self-host image to legacy GHCR namespace | ||
| 131 | if: env.HAS_LEGACY_TOKEN == 'true' | ||
| 132 | shell: bash | ||
| 133 | env: | ||
| 134 | SOURCE_IMAGE: ${{ steps.image.outputs.image }}@${{ steps.build.outputs.digest }} | ||
| 135 | LEGACY_TAGS: ${{ steps.image.outputs.legacy_tags }} | ||
| 136 | run: | | ||
| 137 | set -euo pipefail | ||
| 138 | |||
| 139 | tag_args=() | ||
| 140 | while IFS= read -r tag; do | ||
| 141 | [[ -n "$tag" ]] || continue | ||
| 142 | tag_args+=("-t" "$tag") | ||
| 143 | done <<< "$LEGACY_TAGS" | ||
| 144 | |||
| 145 | docker buildx imagetools create "${tag_args[@]}" "$SOURCE_IMAGE" | ||