Update pnpm-lock.yaml #13
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: DockerHub | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - apps/relay/package.json | |
| - .github/workflows/docker.yaml | |
| env: | |
| REGISTRY: docker.io | |
| IMAGE_NAME: evoluhq/relay | |
| jobs: | |
| push_to_registry: | |
| name: Push Docker image to Docker Hub | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Check if version already published | |
| id: version | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| version=$(jq -r .version apps/relay/package.json) | |
| # Check if this version already exists in Docker Hub | |
| if docker manifest inspect docker.io/evoluhq/relay:$version >/dev/null 2>&1; then | |
| echo "Version $version already published" | |
| changed="false" | |
| else | |
| echo "Version $version not yet published" | |
| changed="true" | |
| fi | |
| echo "new=$version" >> "$GITHUB_OUTPUT" | |
| echo "changed=$changed" >> "$GITHUB_OUTPUT" | |
| - name: Set up QEMU | |
| if: ${{ steps.version.outputs.changed == 'true' }} | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| if: ${{ steps.version.outputs.changed == 'true' }} | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| if: ${{ github.repository == 'evoluhq/evolu' && steps.version.outputs.changed == 'true' }} | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| if: ${{ steps.version.outputs.changed == 'true' }} | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| flavor: | | |
| latest=true | |
| tags: | | |
| # Always push the full (possibly prerelease) version tag | |
| type=semver,pattern={{version}},value=${{ steps.version.outputs.new }} | |
| # Only push major.minor for stable (no hyphen) | |
| type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.new }},enable=${{ !contains(steps.version.outputs.new, '-') }} | |
| - name: Build and push Docker image | |
| if: ${{ github.repository == 'evoluhq/evolu' && steps.version.outputs.changed == 'true' }} | |
| id: push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| context: . | |
| file: ./apps/relay/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: | | |
| type=gha,scope=relay/${{ github.ref_name }} | |
| cache-to: | | |
| type=gha,scope=relay/${{ github.ref_name }},mode=min | |
| provenance: true | |
| sbom: true | |
| - name: Generate artifact attestation | |
| if: ${{ github.repository == 'evoluhq/evolu' && steps.version.outputs.changed == 'true' }} | |
| uses: actions/attest-build-provenance@v1 | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| push-to-registry: true | |
| - name: Publish summary (tags and digest) | |
| if: ${{ github.repository == 'evoluhq/evolu' && steps.version.outputs.changed == 'true' }} | |
| shell: bash | |
| run: | | |
| { | |
| echo '### Docker Image' | |
| echo '' | |
| echo '**Tags:**' | |
| echo '${{ steps.meta.outputs.tags }}' | sed 's/^/- /' | |
| echo '' | |
| echo '**Digest:**' | |
| echo '\`${{ steps.push.outputs.digest }}\`' | |
| echo '' | |
| echo '#### Deploy by digest' | |
| echo '' | |
| echo '```bash' | |
| echo 'docker pull docker.io/evoluhq/relay@${{ steps.push.outputs.digest }}' | |
| echo 'docker run --rm -p 4000:4000 docker.io/evoluhq/relay@${{ steps.push.outputs.digest }}' | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Skip build (fork repository) | |
| if: ${{ steps.version.outputs.changed == 'true' && github.repository != 'evoluhq/evolu' }} | |
| run: echo "Version changed but repository is a fork; skipping Docker login/push/attestation" | |
| - name: Skip build (version unchanged) | |
| if: ${{ steps.version.outputs.changed != 'true' }} | |
| run: echo "apps/relay/package.json version unchanged; skipping Docker build" |