|
10 | 10 |
|
11 | 11 | permissions: |
12 | 12 | contents: read |
13 | | - packages: write |
14 | 13 |
|
15 | 14 | jobs: |
16 | 15 | build: |
@@ -73,42 +72,80 @@ jobs: |
73 | 72 | name: objectstore-${{ matrix.platform }} |
74 | 73 | path: /tmp/objectstore-${{ matrix.platform }}.tar |
75 | 74 |
|
76 | | - assemble-image: |
77 | | - name: Publish |
| 75 | + assemble-ghcr: |
| 76 | + name: Publish to GHCR |
78 | 77 | runs-on: ubuntu-latest |
79 | 78 | needs: [build] |
80 | 79 |
|
81 | 80 | # Intentionally never publish on pull requests |
82 | 81 | if: ${{ github.event_name != 'pull_request' }} |
83 | 82 |
|
| 83 | + permissions: |
| 84 | + packages: write |
| 85 | + |
| 86 | + env: |
| 87 | + REGISTRY: ghcr.io/getsentry/objectstore |
| 88 | + |
84 | 89 | steps: |
85 | 90 | - uses: actions/checkout@v4 |
86 | 91 |
|
87 | 92 | - run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN" |
88 | 93 | env: |
89 | 94 | GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
90 | 95 |
|
91 | | - - name: Download Images |
| 96 | + - &download |
| 97 | + name: Download Images |
92 | 98 | uses: actions/download-artifact@v5 |
93 | 99 | with: |
94 | 100 | pattern: objectstore-* |
95 | 101 | path: /tmp |
96 | 102 | merge-multiple: true |
97 | 103 |
|
98 | | - - name: Push to GitHub Container Registry |
99 | | - env: |
100 | | - REGISTRY: ghcr.io/getsentry/objectstore |
101 | | - SHA_TAG: ${{ github.sha }} |
| 104 | + - &assemble |
| 105 | + name: Push to GitHub Container Registry |
102 | 106 | run: | |
103 | 107 | for PLATFORM in amd64 arm64; do |
104 | 108 | docker load --input /tmp/objectstore-$PLATFORM.tar |
105 | | - docker tag $PLATFORM $REGISTRY:$SHA_TAG-$PLATFORM |
106 | | - docker push $REGISTRY:$SHA_TAG-$PLATFORM |
| 109 | + docker tag $PLATFORM $REGISTRY:${{ github.sha }}-$PLATFORM |
| 110 | + docker push $REGISTRY:${{ github.sha }}-$PLATFORM |
107 | 111 | done |
108 | 112 |
|
109 | | - for TAG in $SHA_TAG latest; do |
| 113 | + for TAG in ${{ github.sha }} latest; do |
110 | 114 | docker manifest create $REGISTRY:$TAG \ |
111 | | - --amend $REGISTRY:$SHA_TAG-amd64 \ |
112 | | - --amend $REGISTRY:$SHA_TAG-arm64 |
| 115 | + --amend $REGISTRY:${{ github.sha }}-amd64 \ |
| 116 | + --amend $REGISTRY:${{ github.sha }}-arm64 |
113 | 117 | docker manifest push $REGISTRY:$TAG |
114 | 118 | done |
| 119 | +
|
| 120 | + assemble-gcr: |
| 121 | + name: Publish to GCR |
| 122 | + runs-on: ubuntu-latest |
| 123 | + needs: [build] |
| 124 | + |
| 125 | + # Intentionally never publish on pull requests |
| 126 | + if: ${{ github.event_name != 'pull_request' }} |
| 127 | + |
| 128 | + permissions: |
| 129 | + id-token: write |
| 130 | + |
| 131 | + env: |
| 132 | + REGISTRY: us-central1-docker.pkg.dev/sentryio/objectstore/image |
| 133 | + |
| 134 | + steps: |
| 135 | + - name: Google Auth |
| 136 | + id: auth |
| 137 | + uses: google-github-actions/auth@v3 |
| 138 | + with: |
| 139 | + workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool |
| 140 | + service_account: [email protected] |
| 141 | + |
| 142 | + - name: "Set up Cloud SDK" |
| 143 | + uses: "google-github-actions/setup-gcloud@v3" |
| 144 | + with: |
| 145 | + version: ">= 390.0.0" |
| 146 | + |
| 147 | + - name: Configure docker |
| 148 | + run: gcloud auth configure-docker us-central1-docker.pkg.dev |
| 149 | + |
| 150 | + - *download |
| 151 | + - *assemble |
0 commit comments