disable publish on cutover #332
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build XMTP Node-go images | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| - rel/** | |
| tags: | |
| - "v*" | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| push_to_registry: | |
| strategy: | |
| matrix: | |
| image: ["node-go", "xmtp-prune-mls"] | |
| name: Push Docker Images to GitHub Packages | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| DOCKER_METADATA_PR_HEAD_SHA: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Log in to the container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Git describe | |
| id: ghd | |
| uses: proudust/gh-describe@v2 | |
| - name: Get Go version from go.mod | |
| id: goversion | |
| run: | | |
| echo "go_version=$(go list -f '{{.GoVersion}}' -m)" >> $GITHUB_OUTPUT | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/xmtp/${{ matrix.image }} | |
| tags: | | |
| type=schedule | |
| type=ref,event=branch | |
| type=ref,event=tag | |
| type=ref,event=pr | |
| type=sha | |
| type=semver,pattern={{version}} | |
| - name: Set up Docker image file based on the matrix variable | |
| id: set_dockerfile | |
| run: | | |
| if [[ "${{ matrix.image }}" == "node-go" ]]; then | |
| echo "dockerfile=Dockerfile" >> $GITHUB_OUTPUT | |
| elif [[ "${{ matrix.image }}" == "xmtp-prune-mls" ]]; then | |
| echo "dockerfile=Dockerfile-prune" >> $GITHUB_OUTPUT | |
| else | |
| echo "Unknown image: ${{ matrix.image }}" | |
| exit 1 | |
| fi | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| id: push | |
| with: | |
| context: . | |
| file: ./dev/docker/${{ steps.set_dockerfile.outputs.dockerfile }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| GIT_COMMIT=${{ steps.ghd.outputs.describe }} | |
| GO_VERSION=${{ steps.goversion.outputs.go_version }} | |
| - name: Save digest output | |
| run: | | |
| echo "digest=${{ steps.push.outputs.digest }}" > ${{ matrix.image }}.txt | |
| - name: Upload digest artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.image }}-digest | |
| path: ${{ matrix.image }}.txt | |
| deploy: | |
| name: Aggregate digests & deploy to infra | |
| runs-on: ubuntu-latest | |
| needs: push_to_registry | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download node-go digest | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-go-digest | |
| path: digests | |
| - name: Download pruner digest | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: xmtp-prune-mls-digest | |
| path: digests | |
| - name: Read and export digests | |
| id: digests | |
| run: | | |
| set -euo pipefail | |
| NODE_GO_DIGEST=$(cut -d= -f2 digests/node-go.txt) | |
| PRUNER_DIGEST=$(cut -d= -f2 digests/xmtp-prune-mls.txt) | |
| if [[ -z "$NODE_GO_DIGEST" || -z "$PRUNER_DIGEST" ]]; then | |
| echo "✖️ One or both digests are empty – aborting deploy." >&2 | |
| exit 1 | |
| fi | |
| NODE_GO_IMAGE="ghcr.io/xmtp/node-go@$NODE_GO_DIGEST" | |
| PRUNER_IMAGE="ghcr.io/xmtp/xmtp-prune-mls@$PRUNER_DIGEST" | |
| echo "node_go_image=$NODE_GO_IMAGE" >> $GITHUB_OUTPUT | |
| echo "pruner_image=$PRUNER_IMAGE" >> $GITHUB_OUTPUT | |
| - name: Deploy Dev | |
| uses: xmtp-labs/terraform-deployer@v1 | |
| timeout-minutes: 45 | |
| with: | |
| timeout: 45m | |
| terraform-token: ${{ secrets.TERRAFORM_TOKEN }} | |
| terraform-org: xmtp | |
| terraform-workspace: dev | |
| variable-name: "xmtp_node_image,xmtp_prune_mls_docker_image" | |
| variable-value: "${{ steps.digests.outputs.node_go_image }},${{ steps.digests.outputs.pruner_image }}" | |
| variable-value-required-prefix: "ghcr.io/xmtp/" |